在使用BarGlass(玻璃柱状图)时要注意在chart.AddElement(bar);之后设置chart.Y_Axis属性若不设置图表什么都不会显示。

如下是正确的调用代码:

                BarGlass bar = new BarGlass();
                XAxisLabels xLabels 
= new XAxisLabels();
                List
<string> xLabelTexts = new List<string>();
                
                List
<BarGlassValue> values = new List<BarGlassValue>();
                
for (int i = 0; i < 20; i++)
                {
                    BarGlassValue bgv 
= new BarGlassValue(1+random.Next(0,i+5));
                    bgv.Colour 
= "#ff0000";
                    xLabelTexts.Add(
"" + i + "");
                    values.Add(bgv);
                }
                bar.Values 
= values;
                xLabels.Values 
= xLabelTexts;
                XAxis xAxis 
= new XAxis();
                xAxis.Labels 
= xLabels;
                chart.X_Axis 
= xAxis;
                chart.AddElement(bar);
                YAxis yaxis 
= new YAxis();
                chart.Y_Axis 
= yaxis;
                chart.Y_Axis.SetRange(
0243);
                e.Graph 
= chart;
相关资源:

相关文章:

  • 2021-08-13
  • 2018-02-01
  • 2021-09-12
  • 2021-08-10
  • 2022-01-03
  • 2021-08-15
  • 2021-06-04
  • 2021-12-28
猜你喜欢
  • 2021-10-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-30
  • 2021-12-26
  • 2021-11-25
相关资源
相似解决方案