This is a migrated thread and some comments may be shown as answers.

RadHtmlChart Dynamic Series X-Axis issue

1 Answer 337 Views
Chart (HTML5)
This is a migrated thread and some comments may be shown as answers.
Jonathan
Top achievements
Rank 1
Jonathan asked on 17 Aug 2018, 08:17 AM

     Hi, 

I have successfully got my Radhtmlchart dynamically creating column series based on some data coming from a SQLDataSource (using VB.net). However, the sql data structure (see attachment below) requires the data to be split across an x axis datetime and my series seems to be just adding the series into the first date value regardless of the value in the sql table. I am obviously doing something wrong here (possibly with my table structure or the code).

What I want to achieve is that the two figures for June appear in the June section of the chart (please see attachment below), and the remaining for July and that the chart knows not to repeat series items if they already exist (in the case of "Defect Undefined" and "Failure").

I have also attached my vb code below which shows how the dynamic series is currently being populated. Any help would be appreciated, i've searched high and low and can't seem to find an example close to what I am looking for. Help!

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 20 Aug 2018, 10:46 AM
Hi Jonathan,

I advise that you start by following this article on the shape of the data the chart needs in order to show data as expected: https://docs.telerik.com/devtools/aspnet-ajax/controls/htmlchart/data-binding/overview. It seems you'd need to group the data source according to the month (the x-axis item you want to show) and put the distinct series items into their own columns. Perhaps the sample project linked in the article can help you get started with this.

If you want to create the series programmatically instead of data biding the chart, you should:

  • remove the DataSource from the chart
  • remove the DataField settings from the series and x-axis
  • ensure that you create the desired series items and axis items by looping the data source
  • avoid creating a new series for each row, instead - you should create series for the distinct values you want to group against (I suppose that's the Reason column)

 


Regards,
Marin Bratanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Chart (HTML5)
Asked by
Jonathan
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or