Jump to content
Software FX Community

Setting Secondary Axis result in "OverflowException" error


MDS
 Share

Recommended Posts

When I perform the following, I get an error "OverflowException was unhandled."  Any idea why?  If I comment out the line series1.YAxis = YAxis.Secondary;, then I don't get the error.

OracleConnection connection = new OracleConnection(connectionString);

string sql = "select month_num, numvalue1, numvalue2 from mytable";using (connection)

{

OracleCommand command = new OracleCommand(sql, connection);

OracleDataAdapter dataAdapter = new OracleDataAdapter(command);dataAdapter.Fill(dataset, "Table0");

}

chart1.DataSourceSettings.DataType[0] = DataType.Label;

chart1.DataSourceSettings.DataType[1] =

DataType.Value;chart1.DataSourceSettings.DataType[2] = DataType.Value;

chart1.DataSource = dataset.Tables[0];

SeriesAttributes series0 = chart1.Series[0];

SeriesAttributes series1 = chart1.Series[1];series0.Gallery = Gallery.Bar;

series1.Gallery =

Gallery.Lines;series1.YAxis = YAxis.Secondary;

chart1.Refresh();

Link to comment
Share on other sites

The problem here is that your secondary Y-Axis remains "uninitialized", that is whitout a scale.

 The best way to avoid this is to move your line:

series1.YAxis = YAxis.Secondary;  

To BEFORE the databindong occurs (before assigning chart.DataSource), this way the secondary Y-Axis scale will be adjusted with the data comming in.

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