How can I create an Angular LineChart where each point on the chart has a different color

1 Answer 8 Views
Charts
BIC
Top achievements
Rank 1
BIC asked on 30 Jul 2025, 04:33 PM

How can I create an Angular LineChart where each point on the chart has a different color, as shown in the attached image?

Thanks

1 Answer, 1 is accepted

Sort by
0
Hetali
Telerik team
answered on 31 Jul 2025, 04:00 PM

Hello BIC,

In order to have a different color for each point on the Kendo UI Line Chart, add the color key-value pair in the data object. For example:

<kendo-chart>
  <kendo-chart-series>
    <kendo-chart-series-item
      type="line"
      [data]="data"
    >
    </kendo-chart-series-item>
  </kendo-chart-series>
</kendo-chart>
public data = [
  { value: 123, color: 'red' }, 
  { value: 276, color: 'yellow' }, 
  { value: 310, color: 'green' },  
  { value: 212, color: 'blue' },  
  { value: 240, color: 'pink' },  
  { value: 156, color: 'gray' },  
  { value: 98, color: 'black' }, 
];

Output:


Additionally, to fill the markers, use the visual property as seen below:

<kendo-chart-series-item
  [markers]="{ size: 12, visual: markerVisual }"
>
</kendo-chart-series-item>
public markerVisual = (e: MarkersVisualArgs): Element => {
  const visual = e.createVisual();
  visual.options.set('fill', { color: visual.options['stroke'].color });
    
  const group = new Group();
  group.append(visual);
    
  return visual;
}

Output:

In this StackBlitz example, I have demonstrated the above mentioned code.

Please let me know if this helps or if I can further assist you.

Regards,
Hetali
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Charts
Asked by
BIC
Top achievements
Rank 1
Answers by
Hetali
Telerik team
Share this question
or