Jump to content
Software FX Community

Question on Mask strings


User (Legacy)

Recommended Posts

I have a PointLabelMask on a pie chart that is working how I need it except 

I would like to format the value number as a currency with no decimals and

still have the percentage value keep 2 decimal places.

The point label mask looks like this:

"%l %p%% ($%v)"

Is there a way to format the string that will come out of the %v or %p? or

is handling the GetPointLabel the best way to do this sort of thing?

Link to comment
Share on other sites

We use the same number of decimals for both numbers so even if you change 

(not sure if you are already doing this) the AxisY.DataFormat.Decimals, they

will both use the same number of decimal places.

The easiest workaround I can think of without using the GetPointLabel event

would be ...

- Set the number of decimals to 2

chart1.AxisY.DataFormat.Decimals = 2;

- Assign the Tag property to all points to be a string formatted as currency

(no decimal places) with the same data value the chart already has, e.g.

for(int i=0;i<chart1.NValues;i++)

chart1.Point[i].Tag =

string.Format("{0:C0}",chart1.Value[0,i]);

- Use %L instead of %v so that your tag is used in the PointLabel

chart1.PointLabelMask = "%l %p%% (%L)";

Depending on other places where we may use the DataFormat.Decimals (e.g.

data editor), you may reverse the strategy and set decimals to be 0 but then

you will have to calculate the percentage for each slice).

We do have another property on each axis called LabelsFormat which we use to

show the labels in a typical bar/line chart, we could use that formatting in

future versions to show the percentage but doing so now would break a lot of

existing code.

--

JC

Software FX Support

"Jason" <jason@cheshire.com> wrote in message

news:Uvjm3c7vFHA.3776@webserver3.softwarefx.com...

>I have a PointLabelMask on a pie chart that is working how I need it except

>I would like to format the value number as a currency with no decimals and

>still have the percentage value keep 2 decimal places.

>

> The point label mask looks like this:

> "%l %p%% ($%v)"

>

> Is there a way to format the string that will come out of the %v or %p? or

> is handling the GetPointLabel the best way to do this sort of thing?

>

>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...