patelajk Posted March 30, 2010 Report Share Posted March 30, 2010 Hi I have a pie chart with some point labels on it and want to display them as 20,000 instead of 20000. Any ideas on how to do this?? I know you can use: Chart1.AllSeries.PointLabels.Format = "%v" to display the value but I dont know how to get the separator in there Thanks Quote Link to comment Share on other sites More sharing options...
juanZ Posted March 30, 2010 Report Share Posted March 30, 2010 Hi, Please look at the following snippet. The point labels will use the format set to the Y Axis. // Define Chart Object and Points int nSeries = 1; int nPoints = 5; Chart1.Gallery = Gallery.Pie; Chart1.Data.Series = nSeries; Chart1.Data.Points = nPoints; // Add sample data to Chart Chart1.Data[0, 0] = 45000; Chart1.Data[0, 1] = 75000; Chart1.Data[0, 2] = 25000; Chart1.Data[0, 3] = 35000; Chart1.Data[0, 4] = 85000; // Configure Point Labels. Chart1.AxisY.LabelsFormat.Culture = new System.Globalization.CultureInfo("en-US"); Chart1.AxisY.LabelsFormat.Format = AxisFormat.Currency; // optional. Chart1.AxisY.LabelsFormat.Decimals = 2; // Make all series to show the value as point labels and show only series 1 Chart1.Series[0].PointLabels.Visible = true; Chart1.AllSeries.PointLabels.Format = "%v"; Hope this helps. Quote Link to comment Share on other sites More sharing options...
patelajk Posted March 31, 2010 Author Report Share Posted March 31, 2010 Is there anyway I can lose the currency symbol??? Quote Link to comment Share on other sites More sharing options...
juanZ Posted March 31, 2010 Report Share Posted March 31, 2010 Hi, try removing this line: Chart1.AxisY.LabelsFormat.Format = AxisFormat.Currency; // optional. Quote Link to comment Share on other sites More sharing options...
patelajk Posted March 31, 2010 Author Report Share Posted March 31, 2010 removing that line results in losing the "thousand separator", which is what I need. Alternatively is there a way I can display the point label as "$20,000 mn" if it is not possible to remove the currency symbol Quote Link to comment Share on other sites More sharing options...
juanZ Posted March 31, 2010 Report Share Posted March 31, 2010 Hi, Try this code: // Define Chart Object and Points int nSeries = 1; int nPoints = 5; Chart1.Gallery = Gallery.Pie; Chart1.Data.Series = nSeries; Chart1.Data.Points = nPoints; // Add sample data to Chart Chart1.Data[0, 0] = 45000; Chart1.Data[0, 1] = 75000; Chart1.Data[0, 2] = 25000; Chart1.Data[0, 3] = 35000; Chart1.Data[0, 4] = 85000; // Configure Point Labels. Chart1.AxisY.LabelsFormat.Culture = new System.Globalization.CultureInfo("en-US"); Chart1.AxisY.LabelsFormat.Format = AxisFormat.Number; // display as number (no currency $). Chart1.AxisY.LabelsFormat.Decimals = 2; // Make all series to show the value as point labels and show only series 1 Chart1.Series[0].PointLabels.Visible = true; Chart1.AllSeries.PointLabels.Format = "%v mn"; Quote Link to comment Share on other sites More sharing options...
patelajk Posted March 31, 2010 Author Report Share Posted March 31, 2010 worked a treat thanks again Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.