Jump to content
Software FX Community

How to format point labels differently from Y axis labels?


samiam1029

Recommended Posts

I formatted Y axis labels (they are numbers) with no decimals at all as follows.

lChart.AxisY.LabelsFormat.Format =

AxisFormat.Number;lChart.AxisY.LabelsFormat.Decimals = 0;

However, I need to show point labels on the graph and I do that by this line of code.

lChart.Series[0].PointLabels.Visible = true;The problem is that the point lables INHERIT the format from y axis format I set above. I want the point labels to show 1 decimal. How to do that? Thanks much.

Link to comment
Share on other sites

  • 4 weeks later...

 Hi,

 please note the use of LabelsFormat and DataFormat in the Axis Y. 

  chart1.Data.Series = 1;   chart1.Data.Points = 3;   chart1.Gallery = ChartFX.WinForms.Gallery.Bar;   chart1.AxisY.LabelsFormat.Format = AxisFormat.Number;   chart1.AxisY.LabelsFormat.Decimals = 0;   chart1.AxisY.DataFormat.Decimals = 1;   chart1.AxisY.Min = 0;   chart1.AxisY.Max = 4;     chart1.Data[0, 0] = 1.5;   chart1.Data[0, 1] = 2.5;   chart1.Data[0, 2] = 3.5;   chart1.Series[0].PointLabels.Visible = true;   chart1.Series[0].PointLabels.Format = "%v";

 

Copy paste this into your load method.

Hope this helps.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...