ChartJS - how to send data to javascript function to create a chartjs via htmlpanel


Is there any examples on how to send (data and labels) from server side to a javascript function to create a chartJs dynamically?

I tried via htmlpanel to create a chart but could not be able to send coorectly the parameters.


  • You must to post comments

I would not recommend using htmlpanel. Instead, use the chartJS extension. It is a nuget package. In Solution Explorer, right-click, choose “Manage Nuget Packages”, and search for “Wisej ChartJS”.

The code to add data and labels to a chartJS chart looks like this:

object[] array1 = new object[] { 1, 3, 5, 7, 9 };
chartJS1.DataSets.Add("Data Set").Data = array1;
chartJS1.Labels = new string[] {

See attached sample project.

Hope this helps!

  • Jun
    • Jun
    • Mar 19, 2024 - 12:27 pm
    hi Julie, thanks for your reply! indeed im using the extension directly, binding data as you explained in your sample. But the reason to send the parameters to a javascript funcion is to customize the graph. It seems that the nuget extension lacks properties to customize it. Thanks.
  • Frank (ITG)
    Hi Jun, what properties are you looking for to customize? Can you please wrap up a test case so we can get a better understanding? TIA, Frank
  • Jun
    • Jun
    • Mar 20, 2024 - 6:42 pm
    for example number formatting and tooltips but in serverside.
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.