ProEssentials图表控件如何实现Y轴自定义比例

作者:控件中国网   出处:控件中国网   2015-08-25 14:25:25   阅读:5

在图表的使用过程中,有些时候传统的Y轴比例模式满足不了客户需求时,需要进行Y轴刻度比例的自定义,ProEssentials完全可根据客户需求自定义各种显示比例,具体可以查看下面的代码

// Disable default scale //
Pego1.PeGrid.Option.ShowYAxis = ShowAxis.Empty;

// Generally, a custom y axis will need manual range control //
Pego1.PeGrid.Configure.ManualScaleControlY = ManualScaleControl.MinMax;
Pego1.PeGrid.Configure.ManualMinY = 0.0;
Pego1.PeGrid.Configure.ManualMaxY = 1500.0;

// Create custom grid lines with HorzLineAnnotations //
// Note that GridLineControl will control these annotations //
Pego1.PeAnnotation.Line.YAxis[0] = 200;
Pego1.PeAnnotation.Line.YAxisType[0] = LineAnnotationType.GridLine;
Pego1.PeAnnotation.Line.YAxisText[0] = "|LLow Value";
Pego1.PeAnnotation.Line.YAxis[1] = 700;
Pego1.PeAnnotation.Line.YAxisType[1] = LineAnnotationType.GridLine;
Pego1.PeAnnotation.Line.YAxisText[1] = "|LMedium Value";
Pego1.PeAnnotation.Line.YAxis[2] = 1400;
Pego1.PeAnnotation.Line.YAxisType[2] = LineAnnotationType.GridLine;
Pego1.PeAnnotation.Line.YAxisText[2] = "|LHigh Value";
Pego1.PeAnnotation.Line.YAxis[3] = 450;
Pego1.PeAnnotation.Line.YAxisType[3] = LineAnnotationType.GridTick;
Pego1.PeAnnotation.Line.YAxisText[3] = "";
Pego1.PeAnnotation.Line.YAxis[4] = 1050;
Pego1.PeAnnotation.Line.YAxisType[4] = LineAnnotationType.GridTick;
Pego1.PeAnnotation.Line.YAxisText[4] = "";

// Set LeftMargin to allocate space for line annotation text //
// Use the longest string used in annotations.
Pego1.PeAnnotation.Line.LeftMargin = "Medium Value ";

// Set this to see annotations //
Pego1.PeAnnotation.Show = true;

// Increase line annotation text size //
Pego1.PeFont.LineAnnotationTextSize = 100;

// Put Grid In Front of Bars and remove banding //
Pego1.PeGrid.GridBands = false;
Pego1.PeGrid.InFront = true;

运行效果:
graphcaxis1.png

Copyright© 2006-2015 ComponentCN.com all rights reserved.重庆磐岩科技有限公司(控件中国网) 版权所有 渝ICP备12000264号 法律顾问:元炳律师事务所
客服软件
live chat