Jump to content
Software FX Community

Axis X labels disordered when switching from Scatter chart to other chart types


piiguu

Recommended Posts

Hi Guys,

I would appreciate if you can help me with this. I am coding a chart to have the ability to switch betwen Scatter chart and other types of chart (say Line chart). In Scatter chart, I am using manual scales for both axis X and Y, while in Line chart I reset axis X to be autoscale and keep axis Y in manual scale. The problem is when the chart is switched from Scatter to Line, the labels in Axis X of the Line chart are in a messy state. The following is the code to reproduce it. What do I miss in this case? I appreiciate if you can help me.

// First show a scatter chart

chart1.Gallery = Gallery.Scatter;chart1.AxisX.AutoScale = false;

chart1.AxisX.ResetScale();

chart1.AxisY.AutoScale = false;

chart1.AxisY.ResetScale();

chart1.AxisX.DataFormat.Format =

AxisFormat.Percentage;chart1.AxisX.LabelsFormat.Format = AxisFormat.Percentage;

chart1.AxisY.DataFormat.Format =

AxisFormat.Percentage;chart1.AxisY.DataFormat.Format = AxisFormat.Percentage;

chart1.Data.Clear();

chart1.Data.Series = 5;

chart1.Data.Points = 1;

chart1.Data.X[0, 0] = 0.025;

chart1.Data.Y[0, 0] = 0.016;

chart1.Data.X[1, 0] = 0.036;

chart1.Data.Y[1, 0] = 0.057;

chart1.Data.X[2, 0] = 0.010;

chart1.Data.Y[2, 0] = 0.008;

chart1.Data.X[3, 0] = 0.016;

chart1.Data.Y[3, 0] = 0.014;

chart1.Data.X[4, 0] = 0.033;

chart1.Data.Y[4, 0] = 0.048;

chart1.AxisX.Min = 0.0;

chart1.AxisX.Max = 0.06;

chart1.AxisX.Step = 0.01;

chart1.AxisY.Min = 0.0;

chart1.AxisY.Max = 0.06;

chart1.AxisY.Step = 0.01;

// Second show a line chartchart1.Gallery = Gallery.Lines;chart1.AxisX.AutoScale = true;

chart1.AxisX.ResetScale();

chart1.AxisY.AutoScale = false;

chart1.AxisY.ResetScale();

chart1.AxisY.DataFormat.Decimals = 1;

chart1.AxisY.LabelsFormat.Decimals = 1;

chart1.Data.Clear();

chart1.Data.Series = 2;

chart1.Data.Points = 5;

chart1.Data[0, 0] = 3.6;

chart1.Data[0, 1] = 1.0;

chart1.Data[0, 2] = 1.6;

chart1.Data[0, 3] = 3.3;

chart1.Data[0, 4] = 1.2;

chart1.Data[1, 0] = 5.7;

chart1.Data[1, 1] = 0.8;

chart1.Data[1, 2] = 1.4;

chart1.Data[1, 3] = 4.8;

chart1.Data[1, 4] = 0.6;

chart1.AxisY.Min = 0.0;

chart1.AxisY.Max = 6.0;

chart1.AxisY.Step = 1.0;

 

 Thanks,

Piiguu

 

Link to comment
Share on other sites

  • 1 month later...

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...