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

Dynamic Chart with Multiple series

1 Answer 298 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Ian
Top achievements
Rank 1
Ian asked on 29 Jan 2020, 12:49 PM

I have a kendo chart I am using within a dashboard.

The definition of the chart contains a link to the data which is returned as a DataSource (using dt.ToDataSourceResult()) and is in the format.

Field 1, Field 2, Field 3

A, 1, 2

B, 2, 2

etc.

The series are defined as 

series:[{field:"Field2",type:"x", categoryField:"field1",axis:"primary", name:"ABC" }

,{field:"Field3",type:"x", categoryField:"Field1",axis:"primary", name:"Contract Value" }]

where type is set to the series type.

 

In scenario 1, Field 1 is a date and we require Field 2 and 3 to each be a separately defined series (one being a bar and the other a line.) this works as we would like.

In scenario 2, Field 1 is a company name and Field 2 and 3 are again separately defined series but both bars. In this case the first series is shown as a bar but the second is missing, however the legend contains an entry for both. What is going wrong? If we change series 2 to a line it appears as before.

I understand we could reshape the data for every instance and have separate definitions but would rather have a single elegant solution. 

Can you shed any light in what is happening?

Thanks

 

1 Answer, 1 is accepted

Sort by
0
Tsvetomir
Telerik team
answered on 31 Jan 2020, 11:28 AM

Hi Ian,

Based on the provided information, I cannot be sure what might be causing the faulty behavior of not showing the accurate series type. Is it possible for you to share the declaration of the Kendo UI Chart and perhaps a runnable sample that I could investigate locally? 

Meanwhile, I would recommend taking advantage of the setOptions() method. This method allows you to change the options of the chart dynamically. For instance, you could redefine the series' declaration according to the selected type that has to be shown. More information about the method could be found in the following article:

https://docs.telerik.com/kendo-ui/api/javascript/dataviz/ui/chart/methods/setoptions

Can you share the exact structure of the data that is returned from the server-side and perhaps a dummy set of data? If the data is in the same format for both types, there is no obvious reason for the chart to omit to render the last bar series.

Looking forward to your reply.

 

Best regards,
Tsvetomir
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
Charts
Asked by
Ian
Top achievements
Rank 1
Answers by
Tsvetomir
Telerik team
Share this question
or