User347430248 posted
Hi
Sidd@Nyork,
you can try to refer example below.
you can try to add 'YValueMembers' using array.
//Give two columns of data to Y-axle
Chart1.Series[0].YValueMembers = "Volume1";
Chart1.Series[1].YValueMembers = "Volume2";
//Set the X-axle as date value
Chart1.Series[0].XValueMember = "Date";
code:
protected void Page_Load(object sender, EventArgs e)
{
DataTable dt = default(DataTable);
dt = CreateDataTable();
//Set the DataSource property of the Chart control to the DataTabel
Chart1.DataSource = dt;
Chart1.Series.Add("Volume");
//Give two columns of data to Y-axle
Chart1.Series[0].YValueMembers = "Volume1";
Chart1.Series[1].YValueMembers = "Volume2";
//Set the X-axle as date value
Chart1.Series[0].XValueMember = "Date";
//Bind the Chart control with the setting above
Chart1.DataBind();
}
private DataTable CreateDataTable()
{
//Create a DataTable as the data source of the Chart control
DataTable dt = new DataTable();
//Add three columns to the DataTable
dt.Columns.Add("Date");
dt.Columns.Add("Volume1");
dt.Columns.Add("Volume2");
DataRow dr;
for (int i = 0; i < 5; i++)
{
//Add rows to the table which contains some random data for demonstration
dr = dt.NewRow();
dr["Date"] = "Jan" + i.ToString();
dr["Volume1"] = 3731;
dr["Volume2"] = 4101;
dt.Rows.Add(dr);
}
return dt;
}
<asp:Chart ID="Chart1" runat="server" Height="588px" Width="784px">
<series>
<asp:Series Name="Series1">
</asp:Series>
</series>
<chartareas>
<asp:ChartArea Name="ChartArea1">
</asp:ChartArea>
</chartareas>
</asp:Chart>
Output:

Regards
Deepak