Product Bundles
DevCraft
All Telerik .NET and Kendo UI JavaScript components and AI Tools in one package.
Kendo UI
Bundle of AI Tools plus four JavaScript UI libraries built natively for jQuery, Angular, React and Vue.
Build JavaScript UI
Javascript
Telerik
Build modern .NET business apps
.Net Web
Cross-Platform
Desktop
Reporting and Documents
AI for Developers & IT
Ensure AI program success
AI Coding
AI Engineering
Additional Tools
Enhance the developer and designer experience
Testing & Mocking
Debugging
UI/UX Tools
CMS
Free Tools
Support
Resources
Design and Productivity Tools
How can I create an Angular LineChart where each point on the chart has a different color, as shown in the attached image?
Thanks
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; }
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.