labels on sparkline

1 Answer 146 Views
Charts
Bob
Top achievements
Rank 1
Iron
Iron
Iron
Bob asked on 05 Aug 2021, 09:37 AM

Given a simple sparkline with static data:


            <kendo-sparkline [chartArea]="{background: ''}"
              style="width:30px; height:30px;"
              type="pie">
              <kendo-chart-series>
                <kendo-chart-series-item [data]="[1,1,1]"
                  [color]="['green', 'yellow', 'red']"
                  [labels]="['Closed', 'Doing or Done', 'To do']"
                  field="value"
                  categoryField="label">
                  <kendo-chart-series-item-tooltip>
                    <ng-template let-category="label"
                      let-value="value">
                      {{category}}: {{value}}
                    </ng-template>
                  </kendo-chart-series-item-tooltip>
                </kendo-chart-series-item>
              </kendo-chart-series>
            </kendo-sparkline>
How do i display the label only in the tooltip?  I have tried using "category" and even a category axis bit to no avail.
Bob
Top achievements
Rank 1
Iron
Iron
Iron
commented on 05 Aug 2021, 10:56 AM

Also, on the above, is it possible to apply a divider line between each slice on the pie chart?

1 Answer, 1 is accepted

Sort by
0
Slavena
Telerik team
answered on 09 Aug 2021, 02:35 PM

Hi Bob,

Thank you for the provided code snippet.

I would advise updating the structure of the SeriesItem data collection and setting it to an array of objects each containing the corresponding value and category. Furthermore, for a visual separator between each SeriesItem I would suggest utilising the border: Border input property:

public border: Border = {
  color: 'black',
  dashType: 'solid',
  width: 0.5
};

This Stackblitz example demonstrates the approaches suggested above.

I hope this helps. Let me know if there are any further questions.

Regards,
Slavena
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Bob
Top achievements
Rank 1
Iron
Iron
Iron
commented on 09 Aug 2021, 04:40 PM

Perfect answer, thanks Slavena.
Tags
Charts
Asked by
Bob
Top achievements
Rank 1
Iron
Iron
Iron
Answers by
Slavena
Telerik team
Share this question
or