Jump to content
Software FX Community

Chart Y2 axis has no scale for negative numbers


User (Legacy)

Recommended Posts

I'm using chartfx.dll Version 6.2.1342.0 (6.2.2211.19403) 20-Jan-2006 10:47:00

I have a line chart with a Y and Y2 axis. When Y2 axis has some points that are all the same value (ie axis.max = axis.min) and are negative numbers, the chart does not draw the scale.

See attached screen shot.

All is well for positive numbers, or if the numbers are negatcibve or not all the same, or if somhow the axis max and min are set, but not if autoscaled.

The sample code is attached.

private void button1_Click(object sender, System.EventArgs e)

{

chart1.AxisY.AutoScale = true;

chart1.AxisY2.AutoScale = true;

chart1.OpenData(SoftwareFX.ChartFX.COD.Values, 3, 10);

System.Random r = new System.Random();

for (int j = 0;j<10;j++)

{

chart1.Value[0, j] =r.NextDouble() * 50;

}

for (int j = 0;j<10;j++)

{

chart1.Value[1, j] =(r.NextDouble() * 80) + 50;

}

chart1.Series[2].YAxis = YAxis.Secondary;

for (int j = 0;j<10;j++)

{

// chart1.Value[2, j] =(r.NextDouble() * 100) + 100;

if (checkBox1.Checked)

{

chart1.Value[2, j] = -5;

}

else

{

chart1.Value[2, j] = 7;

}

}

//chart1.Value[2, 0] = -2;

chart1.CloseData(SoftwareFX.ChartFX.COD.Values);

}

Link to comment
Share on other sites

This is a known behavior. We have changed this in the new version but we can't change it in 6.2 because it would break compatibility.

You can check for this condition right after setting your data and Assign Max = 0 if Max < 0.

You can then set AutoScale back to true to leave the automatic recalculation option on.

--

Francisco Padron

www.chartfx.com

post-2107-13922380935844_thumb.jpg

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...