XtraChart控件X轴的滚动条设置
1、XtraChart的滚动条无法在XtraReport中使用;
2、滚动条无法动态添加(一直没找到可以动态设置的方法);
示例:
DevExpress.XtraCharts.ChartControl xrChart1 = new DevExpress.XtraCharts.ChartControl();
DevExpress.XtraCharts.XYDiagram xyDiagram1 = new DevExpress.XtraCharts.XYDiagram();
xyDiagram1.AxisX.Range.Auto = false; //要开启滚动条必须将其设置为false
xyDiagram1.AxisX.Range.MaxValueInternal = 30.5D > (cnt + 1)?(cnt + 1):30.5D;//在不拉到滚动条的时候,X轴显示多个值,既固定的X轴长度。
xyDiagram1.AxisX.Range.MinValueInternal = -0.5D;
xyDiagram1.AxisX.Range.ScrollingRange.Auto = false;
xyDiagram1.AxisX.Range.ScrollingRange.MaxValueSerializable = (cnt + 1).ToString();//整个X轴最多显示多多少个值
xyDiagram1.AxisX.Range.ScrollingRange.MinValueSerializable = "0";
xyDiagram1.AxisX.Range.ScrollingRange.SideMarginsEnabled = true;//是否从X轴原点开始显示
xyDiagram1.AxisX.Range.SideMarginsEnabled = false;
xyDiagram1.AxisX.VisibleInPanesSerializable = "-1";
xyDiagram1.AxisY.NumericOptions.Format = DevExpress.XtraCharts.NumericFormat.Percent;//显示为百分数
xyDiagram1.AxisY.Range.Auto = false;
xyDiagram1.AxisY.Range.MaxValueSerializable = "1.02";
xyDiagram1.AxisY.Range.MinValueSerializable = "0.5";
xyDiagram1.AxisY.Range.ScrollingRange.SideMarginsEnabled = true;
xyDiagram1.AxisY.Range.SideMarginsEnabled = true;
xyDiagram1.AxisY.VisibleInPanesSerializable = "-1";
xyDiagram1.EnableAxisXScrolling = true;//启用滚动条
xrChart1.Diagram = xyDiagram1;