Pre loader

EDataLabelSkipMode Customization is possible

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

1
0

Hi,

EDataLabelSkipMode Customization is possible with some time range limit?
When i checked the documentation saw the options to skip the label for overlaping. Is it possible can add some index to skip the values. Eg: for Time chart One value is displayed in the chart at 10:30:00. So if i add some index value to skip the next 1 min data. So based on skip index next available value can ba displayed in chart. (10:31:00 or next available value). Can you implement this option to skip ?

Version
3.2.464
  • You must to post comments
0
0

Hi Arun

There are a number of skip modes built-in for datalabels which will automatically cull based on the number of points shown, iflabels are overlapping etc. Take a look at the DataLabel SkipModes and Culling documentation for more details.

However, if you wanted to write a custom skipping algorithm for datalabels, it might be easier to do something like this:

In the Getting Labels from Metadata documentation, we show how you can return strings from objects in metadata into the labels:

// Assuming metadata has been constructed in the dataseries and dataLabels enabled,
// you can format labels with metadata using dataLabelProvider.getText(dataLabelState)
sciChartSurface.renderableSeries.get(0).dataLabelProvider.getText = (dataLabelState) => {
    return `index=${dataLabelState.index}, 
    x,y=[${dataLabelState.xVal()}, ${dataLabelState.yVal()}], 
    metadata="${dataLabelState.getMetaData()?.text}"`;
};

You could include properties to show/hide labels here, e.g.

sciChartSurface.renderableSeries.get(0).dataLabelProvider.getText = (dataLabelState) => {
    return dataLabelState.getMetaData()?.showLabel ? `${dataLabelState.yVal()}` : ``;
};

Here’s a codepen demonstrating the concept. This only shows labels on point 0, 1, 5, and 10 by adding metadata values { showLabel: true } or { showLabel: true } to show and hide each label. See the codepen for more details on how I’ve implemented this.

Taking this a step further, if there is a programmatic rule when to show labels you may not need metadata at all. Instead, test if the xValue is divisible by 30 seconds for example

Hope this helps,

Best regards
Andrew

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.