Jump to content
Software FX Community

Percentage axis


DannE
 Share

Recommended Posts

is it possible to set the precision of an axis to one decimal place (i want 0.3465 to be displayed as 34.7%) using: chModContribution.AxisY.LabelsFormat.Format = AxisFormat.Percentage;if I use

chModContribution.AxisY.LabelsFormat.CustomFormat = "0.0%"; then the values are not rounded

 Any suggestions?

Link to comment
Share on other sites

The Y axis labels don't correspond to the values, there is a min a max and a step. There may be values between the labels.

In other words, if one of the values in your data is 0.55 there is nothing that will force a label at that particular point.

If you feel I an not understanding what you mean, please post a piece of code that reproduces the situation and indicate what you were expecting vs. what you got.

Link to comment
Share on other sites

Here is an exact copy the code that I am using: 

protected override void OnPreRender(EventArgs e){ 

DataSet result = Miscellaneous.DataAccess("exec GetData'");

chModContribution.DataSource = result.Tables[0];

chModContribution.DataBind();

chModContribution.Gallery = SoftwareFX.ChartFX.Gallery.Bar;

chModContribution.Titles[0].Text = title;

chModContribution.BackColor = System.Drawing.Color.White;

chModContribution.SerLegBox = true;

chModContribution.PointLabels =

true;chModContribution.AxisX.Visible= false;

chModContribution.AxisY.LabelsFormat.Format = AxisFormat.Percentage;

chModContribution.AxisY.LabelsFormat.Decimals = 1;

//chModContribution.AxisY.LabelsFormat.CustomFormat = "0.0%";

chModContribution.PointLabelMask = "%s \n %v";

chModContribution.BorderObject.Color = System.Drawing.Color.Black;

chModContribution.ImgQuality = 100;

chModContribution.AxesStyle = SoftwareFX.ChartFX.AxesStyle.Math;

chModContribution.AxisX.Line.Color = Color.Transparent;

chModContribution.Series[0].PointLabelFont = new System.Drawing.Font("Arial", 7);

chModContribution.Series[1].PointLabelFont =

new System.Drawing.Font("Arial", 7);chModContribution.Series[2].PointLabelFont = new System.Drawing.Font("Arial", 7);

chModContribution.Series[3].PointLabelFont =

new System.Drawing.Font("Arial", 7);chModContribution.Series[4].PointLabelFont = new System.Drawing.Font("Arial", 7);

chModContribution.Series[5].PointLabelFont =

new System.Drawing.Font("Arial", 7);chModContribution.Series[6].PointLabelFont = new System.Drawing.Font("Arial", 7);

chModContribution.Series[7].PointLabelFont =

new System.Drawing.Font("Arial", 7);

chModContribution.ContextMenus =

true;

base

.OnPreRender (e);

}

 There is one datapoint the value of which is ("P/E", 0.0555), what I am expecting is 5.6% for this point what I get is 5.5%

Link to comment
Share on other sites

Here is an exact copy the code that I am using: 

protected override void OnPreRender(EventArgs e){ 

DataSet result = Miscellaneous.DataAccess("exec GetData'");

chModContribution.DataSource = result.Tables[0];

chModContribution.DataBind();

chModContribution.Gallery = SoftwareFX.ChartFX.Gallery.Bar;

chModContribution.Titles[0].Text = title;

chModContribution.BackColor = System.Drawing.Color.White;

chModContribution.SerLegBox = true;

chModContribution.PointLabels =

true;chModContribution.AxisX.Visible= false;

chModContribution.AxisY.LabelsFormat.Format = AxisFormat.Percentage;

chModContribution.AxisY.LabelsFormat.Decimals = 1;

//chModContribution.AxisY.LabelsFormat.CustomFormat = "0.0%";

chModContribution.PointLabelMask = "%s \n %v";

chModContribution.BorderObject.Color = System.Drawing.Color.Black;

chModContribution.ImgQuality = 100;

chModContribution.AxesStyle = SoftwareFX.ChartFX.AxesStyle.Math;

chModContribution.AxisX.Line.Color = Color.Transparent;

chModContribution.Series[0].PointLabelFont = new System.Drawing.Font("Arial", 7);

chModContribution.Series[1].PointLabelFont =

new System.Drawing.Font("Arial", 7);chModContribution.Series[2].PointLabelFont = new System.Drawing.Font("Arial", 7);

chModContribution.Series[3].PointLabelFont =

new System.Drawing.Font("Arial", 7);chModContribution.Series[4].PointLabelFont = new System.Drawing.Font("Arial", 7);

chModContribution.Series[5].PointLabelFont =

new System.Drawing.Font("Arial", 7);chModContribution.Series[6].PointLabelFont = new System.Drawing.Font("Arial", 7); chModContribution.Series[7].PointLabelFont = new System.Drawing.Font("Arial", 7);

chModContribution.ContextMenus =

true;

base

.OnPreRender (e);

}

 There is one datapoint the value of which is ("P/E", 0.0555), what I am expecting is 5.6% for this point what I get is 5.5%

Link to comment
Share on other sites

Since you didn't include your datasource, I added one point to the chart manually as follows:

//DataSet result = Miscellaneous.DataAccess("exec GetData'");

//Chart1.DataSource = result.Tables[0];

//Chart1.DataBind();Chart1.OpenData(COD.Values,1,1);

Chart1.Value[0,0] = 0.0555;

Chart1.CloseData(

COD.Values) ;

And I get a label of 5.6% for the point.

Attached is a picture of the chart I get.

I suspect this is a problem with your data. If you provide me a piece of code that I can run here, including data and everything, I can give you further guidance. As of now I am not able to reproduce the situation you describe (you can try this code on your end).

 

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.

 Share

×
×
  • Create New...