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

Line chart plotting all values but only label some xAxis values

3 Answers 172 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Lester
Top achievements
Rank 1
Lester asked on 16 May 2014, 02:25 PM
Hi,

   I need to plot 4 series with a total of 90
daily values.

Based on
what I have tried, I can have all the values with the label superposing in the xAxis or I can create a chart that skips points and then miss important values for the customer.

Is it possible to plot all the values but “skip” a configurable amount of labels?

I can also provide a list of the labels that I would like to be used…just don’t know how to inject the “serie for the xAxis”, even with some undefined or null points for the ones I don't want labeled.

Thanks,

Lester

3 Answers, 1 is accepted

Sort by
0
Hristo Germanov
Telerik team
answered on 20 May 2014, 09:04 AM
Hello Lester,

In this case you need to use labels.template. In this template you can change the axis.labels text. For example:
function(value) {
   var axisStrings = ["A", "B", "C"];
   if (value == 20 ) return axisStrings[0];
   return "";
}
I hope this helps.

Regards,
Hristo Germanov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Lester
Top achievements
Rank 1
answered on 20 May 2014, 11:12 AM
Hristo,
  I appreciate your reply.

Unfortunately this seems a quite complicated solution that probably requires generating a dynamic function on the fly. Also depending on the number of points and the device it might be quite inefficient.

Is there any other way to accomplish what I need? Honestly this is the first chart package that I have used that draws an inaccurate image of points even when the number of data points is less than the number of pixels.

In my opinion should be as easy as plotting all the points but labeling every x values, at least. The more elaborated way could be using canvas measureText when available and figuring out the best possible spacing. I have done it myself for a very web trading application (x Axis).

Thank you again for your effort, though.

Lester
 


0
Hristo Germanov
Telerik team
answered on 20 May 2014, 11:24 AM
Hi Lester,

You can use labels.skip and labels.step if you want. But this mean that you need to know what is the max of the categories.

If this can't help you could you please send me some piece of code or sample example that I can examine and advice you further?

You can easily build a sample project with our online tool: http://trykendoui.telerik.com/ or you can edit/modify some of our online example.

Regards,
Hristo Germanov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Charts
Asked by
Lester
Top achievements
Rank 1
Answers by
Hristo Germanov
Telerik team
Lester
Top achievements
Rank 1
Share this question
or