export to data table error


Author
Message
Milen
Milen
Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)
Group: Nevron Team
Posts: 48, Visits: 1

Hello Bruce,

Most probably the data series that you export are of different length - please check whether the Values, XValues and Labels data series contain the same number of items. If not - you have to explicitly align the data series lengths. One way to do this is to call the Align method of the data series collection before calling ExportToDataTable. Please note that this will modify the original data series, so in order to avoid this you can add cloned versions of the data series in arrSeries, then call arrSeries.Align and then call arrSeries.ExportToDataTable.

Best Regards,
Milen


Bruce Guthrie
Bruce Guthrie
Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)
Group: Forum Members
Posts: 14, Visits: 2

hello

i am trying to export a simple Line chart data (XY series) to a data table.  i think i follow your examples but i keep getting the same error when i run, that the "The data series must have the same size."

Private Sub nExportData_Click(ByVal sender As System.Object, ByVal e As Nevron.UI.WinForm.Controls.CommandEventArgs) Handles nExportData.Click

Dim chart As NChart = myChartCtrl(selectedChart).Charts(0)

Dim arrSeries As NDataSeriesCollection = New NDataSeriesCollection()

Dim sTableName As String = ""

Dim dataView1 = New System.Data.DataView()

Dim myDataGrid = New System.Windows.Forms.DataGrid()

Dim line As NLineSeries = CType(chart.Series(0), NLineSeries)

'Dim myGrid As NDataSeriesGrid

sTableName = myChartCtrl(selectedChart).Name

arrSeries.Add(line.Values, DataSeriesMask.Values)

arrSeries.Add(line.XValues, DataSeriesMask.XValues)

arrSeries.Add(line.Labels, DataSeriesMask.Labels)

' customize the toolbar of the grid

'NChartGridControl1.ChartGridButtonsMask = ChartGridButtonsMask.UpdateGridFromSeries Or ChartGridButtonsMask.UpdateSeriesFromGrid Or ChartGridButtonsMask.BindToChart

' create your datagrid derivate

'myGrid = New NDataSeriesGrid()

'myGrid.DataSource = arrSeries.ExportToDataTable("Line Chart")

' replace the data grid used by the NChartGridControl

'NChartGridControl1.DataSeriesGrid = myGrid

' bind to the chart control

'NChartGridControl1.ChartControl = myChartCtrl(selectedChart)

Dim datatable As DataTable = arrSeries.ExportToDataTable("kl") --- fails here no matter what i put as the string.

'dataView1 = New System.Data.DataView()

'dataView1.Table = arrSeries.ExportToDataTable("kl")

NDataGridView1.DataSource = datatable

Me.DataGrid.DataSource = datatable

Me.Controls.Add(myDataGrid)

myDataGrid.Visible = True

myChartCtrl(selectedChart).Refresh()

End Sub

 

i cannot get past the arrSeries.ExportToDataTable command.

 

can you help, i follow your code examples but i cannot export the data.

Regards

bruce

 


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search