Jump to content
Software FX Community

Setting Secondary Axis result in "OverflowException" error


MDS

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

Archived

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

×
×
  • Create New...