DotNetCharting >> 柱状图

段干昊然
2023-12-01

 DataTable dt = SqlFactory.ResourceClass.dtCustomerOrderCount();
   
    //Y 轴的上限,用于控制最大的订单数目是多少
    int[] minmax = CommonFactory.StaticVarList.minAndMax(dt);

    int countNum = CommonFactory.StaticVarList.intCountNum(dt);
    this.OrderNumChart.Title ="订单总量:"+countNum;
   
    //标题的颜色
    this.OrderNumChart.TitleBox.Label.Color = Color.Red;
    //标题的背景色
    this.OrderNumChart.TitleBox.Background.Color = Color.Pink;
    //是否显示底部工具栏
    this.OrderNumChart.Mentor = false;
    //文件jpg存放的位置
    this.OrderNumChart.TempDirectory = "../../../temp";
    //说明总数的文字背景
    this.OrderNumChart.LegendBox.Background.Color = Color.Pink;

    //绑定资源
    this.OrderNumChart.Series.Data = dt;
    this.OrderNumChart.PaletteName =  ch.Palette.WarmEarth;
   
     //控件是否是3D格式
     this.OrderNumChart.LegendBox.Visible = false;
     this.OrderNumChart.Use3D = true;
    this.OrderNumChart.ShadingEffect = true;
    this.OrderNumChart.DefaultElement.Color = Color.RoyalBlue;
    this.OrderNumChart.ShadingEffectMode = ch.ShadingEffectMode.Five;

    //Y 轴的刻度范围
    ch.ScaleRange range = new dotnetCHARTING.ScaleRange(1,countNum);
   
    //Y轴说明
    this.OrderNumChart.YAxis.Label.Color =Color.Red;
    this.OrderNumChart.YAxis.ScaleRange = range;
    this.OrderNumChart.YAxis.Scale  = ch.Scale.Range;
    this.OrderNumChart.YAxis.Label.Font = new Font("Arial Black",9,FontStyle.Bold);
    this.OrderNumChart.YAxis.TickLabelPadding =0;
    this.OrderNumChart.YAxis.Line.StartCap =System.Drawing.Drawing2D.LineCap.Square;
    this.OrderNumChart.YAxis.Line.EndCap = System.Drawing.Drawing2D.LineCap.ArrowAnchor;
    this.OrderNumChart.YAxis.Line.Width = 2;
    this.OrderNumChart.YAxis.Line.Color = Color.Gray;

    //X轴说明

    this.OrderNumChart.XAxis.Label.Font = new Font("Arial Black",9,FontStyle.Bold);
    this.OrderNumChart.XAxis.Line.EndCap = System.Drawing.Drawing2D.LineCap.ArrowAnchor;
    this.OrderNumChart.XAxis.Line.Width = 2;
    this.OrderNumChart.XAxis.StaticColumnWidth = 10; //每个单元格的宽度
    this.OrderNumChart.XAxis.SweepAngle =45;
    this.OrderNumChart.XAxis.Line.Color = Color.Gray;

    //生产图像
    this.OrderNumChart.SeriesCollection.Add(); 

 类似资料: