I have a piechart, binding data from a storedprocedure. I am getting 2 columns one is Age and BusinessTotal. Based on Age column data, Color should be showed. Please let me know how to accomplish this.
<telerik:RadHtmlChart runat="server" ID="RadHtmlChart3" Width="300" Height="300" Transitions="true">
<Appearance>
<FillStyle BackgroundColor="White"></FillStyle>
</Appearance>
<Legend>
<Appearance BackgroundColor="White" Position="Right" Visible="false">
</Appearance>
</Legend>
<PlotArea>
<Appearance>
<FillStyle BackgroundColor="White"></FillStyle>
</Appearance>
<Series>
<telerik:PieSeries DataFieldY="BusinessTotal" StartAngle="90" >
<LabelsAppearance Visible="false" Position="InsideEnd" DataFormatString="{0:N0}">
</LabelsAppearance>
<TooltipsAppearance Color="White" DataFormatString="{0:N0}"></TooltipsAppearance>
Databinding : C#
protected void GetBusinessData(string metricName)
{
SqlCommand cmdProc = new SqlCommand("[oss].[SelectSalespersonBusinessAge]", SqlConnection);
cmdProc.CommandType = CommandType.StoredProcedure;
cmdProc.Parameters.AddWithValue("@LoginName", loginName);
cmdProc.Parameters.AddWithValue("@MetricYear", metricYear);
cmdProc.Parameters.AddWithValue("@MetricMonth", metricMonth);
SqlDataAdapter adp = new SqlDataAdapter();
adp.SelectCommand = cmdProc;
adp.Fill(dt);
RadHtmlChart3.DataSource = dt;
RadHtmlChart3.DataBind();
if (dt.Rows[0]["age"].ToString() == "7-12 Months")
{
//Yellow color should be assigned for this part
}
if (dt.Rows[1]["age"].ToString() == "12+ Months")
{
//REd for this
}
}
<telerik:RadHtmlChart runat="server" ID="RadHtmlChart3" Width="300" Height="300" Transitions="true">
<Appearance>
<FillStyle BackgroundColor="White"></FillStyle>
</Appearance>
<Legend>
<Appearance BackgroundColor="White" Position="Right" Visible="false">
</Appearance>
</Legend>
<PlotArea>
<Appearance>
<FillStyle BackgroundColor="White"></FillStyle>
</Appearance>
<Series>
<telerik:PieSeries DataFieldY="BusinessTotal" StartAngle="90" >
<LabelsAppearance Visible="false" Position="InsideEnd" DataFormatString="{0:N0}">
</LabelsAppearance>
<TooltipsAppearance Color="White" DataFormatString="{0:N0}"></TooltipsAppearance>
Databinding : C#
protected void GetBusinessData(string metricName)
{
SqlCommand cmdProc = new SqlCommand("[oss].[SelectSalespersonBusinessAge]", SqlConnection);
cmdProc.CommandType = CommandType.StoredProcedure;
cmdProc.Parameters.AddWithValue("@LoginName", loginName);
cmdProc.Parameters.AddWithValue("@MetricYear", metricYear);
cmdProc.Parameters.AddWithValue("@MetricMonth", metricMonth);
SqlDataAdapter adp = new SqlDataAdapter();
adp.SelectCommand = cmdProc;
adp.Fill(dt);
RadHtmlChart3.DataSource = dt;
RadHtmlChart3.DataBind();
if (dt.Rows[0]["age"].ToString() == "7-12 Months")
{
//Yellow color should be assigned for this part
}
if (dt.Rows[1]["age"].ToString() == "12+ Months")
{
//REd for this
}
}