Ejemplo n.º 1
0
        /// <summary>
        /// 加载报表的默认显示样式
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void GoldChartControl_Load(object sender, EventArgs e)
        {
            TSeries series1 = new TSeries("Series1");

            series1.Points.Add(new TSeriesPoint("A", 10));
            series1.Points.Add(new TSeriesPoint("B", 12));
            series1.Points.Add(new TSeriesPoint("C", 14));
            series1.Points.Add(new TSeriesPoint("D", 17));
            series.Add(series1);
            this.Run();
            series.Clear();
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 开始构建报表
 /// </summary>
 public void Run()
 {
     if (series.Count == 0)
     {
         return;
     }
     this.InitImg();
     this.InitChartImg();
     //画报表标题
     if (IsShowChartName)
     {
         this.DrawChartName();
     }
     #region 画X、Y轴上的刻度
     //画图例
     this.DrawLegend();
     //画原点
     this.DrawIntersection();
     //画X、Y轴
     this.DrawXY();
     //画X轴上的刻度
     TSeries first      = series.First();
     var     allXPoints = first.Points.Select(s => s.Argument).ToList();
     this.DrawXPoints(allXPoints);
     //画Y轴的刻度
     var   maxValue       = series.SelectMany(s => s.Points).Max(m => m.Value);
     var   maxTargetValue = series.SelectMany(s => s.Points).Max(m => m.TargetValue);
     float maxYValue      = maxTargetValue > maxValue ? maxTargetValue : maxValue;
     this.DrawYPoints(maxYValue);
     #endregion 画X、Y轴上的刻度
     //画项目柱状图
     var lst_points = series.SelectMany(s => s.Points).ToList();
     this.DrawXItems(lst_points);
     //画提示框
     this.DrawTipRectangle();
     //画关联线
     if (IsShowAssociation)
     {
         this.DrawAssociation();
     }
     //显示报表图
     this.ShowChartImg();
 }