I have a pie chart in .asp.net called chrt. I would like the values instead of the labels to show up in the chart with currency formatting. I want the labels to show up in the legend. I do the following and get Values shown on my chart instead of the labels, and the labels still show up in the legend.
chrt.Series[0].IsValueShownAsLabel = true;
Example:
Chart Shows "12345.678" Legend Shows "Sales"
All I need now is to get the chart to show with dollars.
If I then do the following, it changes the formatting to currency on the chart but unfortunately replaces the labels in the legend with the currency formatted values.
foreach (Series b in chrt.Series)
{
foreach (DataPoint c in b.Points)
{
//Sets both legend and chart value
c.Label = c.YValues[0].ToString("C");
}
}
Example:
Chart Shows "$12345.68" Legend Shows "$12345.68"
I've also tried the code below, but it sets the legend to the values and formats it to currency, leaving the values on the chart as is.
foreach (Series b in chrt.Series)
{
foreach (DataPoint c in b.Points)
{
//Sets just the legend to the dollar values
c.AxisLabel = c.YValues[0].ToString("C");
}
}
Example:
Chart Shows "12345.678" Legend Shows "$12345.68"
All I want it to show is
Chart Shows "$12345.68" Legend Shows "Sales"