Add datapoints to series line-chart from database (ChartJS?)

0
0

Hello,

we are currently trying to convert a WinForms application for displaying data from our warehouse management database.

At one part of the orginal programm we use a standard Chart control from the toolbox to display a line graph, where two data sets are being displayed.
In the program we use a for-loop to add new DataPoints to the chart.

We’ve have tried to do the same after installing ChartJS, however we were not able to find a solution.
Below is an example of how we add the DataPoints in the orginal application.

Could you tell me if this is even possible using ChartJS? And if so, could you provide a small example?


foreach (DataRow pRow in DataAdapter.GetData().Rows)
{
chart1.Series["Auslagerung"].Points.AddXY(pRow["EINLAGERDATUM"], pRow["ANZAHL_AUSLAGERUNGEN"]);
chart1.Series["Einlagerung"].Points.AddXY(pRow["EINLAGERDATUM"], pRow["ANZAHL_EINLAGERUNG"]);
}

Thank you in advance and kind regards,
Tom

  • You must to post comments
0
0

Hello Tom-Lucas,

You can check out this sample we have on our DemoBrowser application: https://demo.wisej.net/#Extensions/ChartJS/Line

The source code is also public, you can check it out from here: https://github.com/iceteagroup/Wisej-DemoBrowser/

Best,
Alaa

//

  • Tom-Lukas Rugen
    Thanks for your fast answer, the chart itself works now. However the ToolTip/Datalabel of the chart only shows “[object Object]” instead of the value. I also have this problem with the line chart in the demo.
  • Alaa (ITG)
    Hi Tom, please check out the new source code for the Line demo, you’ll have to use the “Formatted” property to format the label of an entry in your DataSet.
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.