DevExpress之ChartControl的SeriesTemplate实例

前端技术 2023/09/08 C#

本文实例讲述了DevExpress之ChartControl的SeriesTemplate用法,分享给大家供大家参考。具体方法如下:

关键代码如下:

复制代码 代码如下:
using System;
using System.Data;
using System.Windows.Forms;
using CSharpUtilHelpV2;
using DevExpress.XtraCharts;

namespace DevExpressChart
{
    public partial class winGsp : Form
    {
        public winGsp()
        {
            InitializeComponent();
        }
        static readonly string AccessFullPath = string.Format(@\"{0}\\gsp.mdb\", AppDomain.CurrentDomain.BaseDirectory);
        static DataTable GspList = null;
        AccessUtilsV2 AccessHelper = null;
        private void winGsp_Load(object sender, EventArgs e)
        {

            AccessHelper = new AccessUtilsV2(AccessFullPath);
            GspList = AccessHelper.ExecuteDataTable(\"select * from Gsp\", null);
            BuilderDevChart();
        }
        private void BuilderDevChart()
        {
            if (GspList != null)
            {
                chartControl1.SeriesDataMember = \"Year\";
                chartControl1.SeriesTemplate.ArgumentDataMember = \"Region\";
                chartControl1.SeriesTemplate.ValueDataMembers.AddRange(new string[] { \"GSP\" });
                chartControl1.SeriesNameTemplate.BeginText = \"GSP in \";
                chartControl1.DataSource = GspList;

                chartControl1.SetXLableAngle(-35);
                chartControl1.SetCrosshair(true);

                chartControl1.Legend.Direction = LegendDirection.LeftToRight;
                chartControl1.Legend.AlignmentHorizontal = LegendAlignmentHorizontal.Center;
                chartControl1.Legend.AlignmentVertical = LegendAlignmentVertical.BottomOutside;

                chartControl1.AddTitle(\"GSP List\");
            }
        }
    }
}

本文地址:https://www.stayed.cn/item/23160

转载请注明出处。

本站部分内容来源于网络,如侵犯到您的权益,请 联系我

我的博客

人生若只如初见,何事秋风悲画扇。