In run mode chart is displaying.
I have one button when i click that button i want to display that chart in new tab windows for that how to do in asp.net
My code as follow
<asp:Chart ID="Chart2" runat="server" BackColor="Gray" BackGradientStyle="None" Width="360px">
<Series>
<asp:Series Name="Series1" ChartType="Column" BorderColor="#669999" XValueMember="LeaveType" YValueMembers="percentage" IsValueShownAsLabel="true"></asp:Series>
</Series>
<ChartAreas>
<asp:ChartArea Name="ChartArea1" BackColor="Silver" BackGradientStyle="None">
</asp:ChartArea>
</ChartAreas>
</asp:Chart>
Aspx page code as follows
protected void BindGrid()
{
DataTable _objdt = new DataTable();
_objdt.Columns.Add("LeaveType", typeof(string));
_objdt.Columns.Add("percentage", typeof(long));
_objdt.Columns.Add("LabelValue");
var _objrow = _objdt.NewRow();
_objrow["LeaveType"] = "Present";
_objrow["percentage"] = 80;
_objdt.Rows.Add(_objrow);
_objrow = _objdt.NewRow();
_objrow["LeaveType"] = "Absent";
_objrow["percentage"] = 5;
_objdt.Rows.Add(_objrow);
_objrow = _objdt.NewRow();
_objrow["LeaveType"] = "Leave";
_objrow["percentage"] = 15;
_objdt.Rows.Add(_objrow);
Chart2.DataSource = _objdt;
Chart2.DataBind();
Chart2.ChartAreas["ChartArea1"].AxisX.MajorGrid.Enabled = false;
Chart2.ChartAreas["ChartArea1"].AxisY.MajorGrid.Enabled = false;
foreach (Series series in Chart2.Series)
{
foreach(DataPoint point in series.Points)
{
if (point.YValues[0] >= 50 && point.YValues[0] <= 90)
{
point.Color = Color.RoyalBlue;
}
else if (point.YValues[0] >= 1 && point.YValues[0] <= 6)
{
point.Color = Color.Yellow;
}
else
{
point.Color = Color.Red;
}
}
}
}