如何用代码使饼形图上数字变为百分数,而图例不受影响,数据和文字都来自sqlite数据库

图片说明

 string dbPath = @"D:\历年高考分数.db";
            string sq = @"Data Source=" + dbPath;
            m = new SQLiteConnection(sq);
            m.Open();
            SQLiteDataAdapter mAdapter = new SQLiteDataAdapter("select Volume1,Volume2 from 饼形图2", m);
            DataSet ds = new DataSet();
            mAdapter.Fill(ds);
            DataTable dt = ds.Tables[0];
            //设置图表的数据
            chart3.DataSource = dt;
            //chart3.Series.Clear();
            chart3.Series[0].ChartType = SeriesChartType.Pie;//设置形状
            chart3.Series[0].XValueMember = "Volume1";//图例数据成员列
            chart3.Series[0].YValueMembers = "Volume2";//饼形图上数据成员列
            chart3.Series[0].IsValueShownAsLabel = true;//显示标签
            chart3.DataBind();
            chart3.Width = 260;
            chart3.Height = 260;
            m.Close();

下面的几种尝试都不对
一:chart1.ChartAreas[0].AxisX.LabelStyle.Format = "#LEGENDTEXT";//显示当前图例的标签文本
chart1.ChartAreas[0].AxisY.LabelStyle.Format = "#VAL%";//显示当前图例的所占的百分比
二:chart1.Series[0].Label = "#VALY%";
三:chart1.ChartAreas[0].AxisX.LabelStyle.Format = "#VALX";
chart1.ChartAreas[0].AxisY.LabelStyle.Format = "#VALY%";

已解决,chart1.Series[0].XValueType = ChartValueType.String;x轴显示类型的问题

多简单,拼接一个字符串就可以了

图片说明

new Series("series1")
{
    ChartType = SeriesChartType.Pie,
    LegendText = "#INDEX:#VALX",
    Label = "#INDEX:#PERCENT",
    IsValueShownAsLabel = false,
    IsXValueIndexed = false,
    ToolTip = "#VALX",
    XValueMember = "Worker",
    YValueMembers = "ProductPrice",
}

Label = "#PERCENT"