Jump to content
Software FX Community

X Axis Scaling when linked to a Datagrid


User (Legacy)

Recommended Posts

Hi,

I've been having a problem getting charts to draw correctly when I have a

chart linked to a DataSet which is also linked to a DataGrid. I have set an

event handler to refresh the data in the chart when the DataGrid is edited,

however the chart is helpfully drawn starting at the item I've just edited

(presumably the 'Active Item' in the data table)

Is there any way of stopping this happening - I've tried setting min and max

vaules of the X axis but it hasn't solved anything!

Thanks,

Mark

--- Code snippet ---

public DataManager( string dbname)

{

/* Cut dg and ds init code */

dsData.Tables["tData"].RowChanged += new

DataRowChangeEventHandler(TableDataChanged);

}

public void SetDataBindings( System.Windows.Forms.DataGrid dg,

SoftwareFX.ChartFX.Chart chart )

{

dg.DataSource = dsData.Tables["tData"];

chart.DataSourceSettings.DataType[0] = SoftwareFX.ChartFX.DataType.NotUsed;

chart.DataSourceSettings.DataType[1] = SoftwareFX.ChartFX.DataType.Label;

chart.DataSourceSettings.DataType[2] = SoftwareFX.ChartFX.DataType.Value;

chart.DataSource = dsData.Tables["tData"];

chart.RecalcScale();

chart.AxisX.Min = 0;

chart.AxisX.Max = 10;

this.chart = chart;

this.datagrid = dg;

}

private void TableDataChanged(object sender, DataRowChangeEventArgs e)

{

SetDataBindings( datagrid, chart );

}

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...