User (Legacy) Posted July 21, 2005 Report Share Posted July 21, 2005 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 More sharing options...
Software FX Posted July 25, 2005 Report Share Posted July 25, 2005 Chart FX reads from a DataSet from the position where the DataSet is on, this is by design to allow reading of partial DataSets, make sure BEFORE you refresh the Chart Data you Rewind the DataSet to the beginning. -- Francisco Padron www.chartfx.com Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.