possible in angular?
Hi Chong,
Using pointColorMapping we can change the color of each individual point in a series.
We have attached an example to illustrate this.
Code-snippet:
|
public data: Object[] = [ { Country : "GBR", GoldMedal : 27,color: 'red' }, ]; <ejs-chart> <e-series-collection> <e-series pointColorMapping='color' > </e-series> </e-series-collection> </ejs-chart> |
Screenshot:
Sample: https://stackblitz.com/edit/angular-aaaf1j?file=src%2Fapp.component.ts,src%2Fapp.component.html
Kindly revert us if you have any concerns.
Regards,
Nishanthi
Hi Ramya,
we can style graphs using theme property , is it possible to fetch colors from the same theme and set different colors in bars
Thanks
Hi Saurabh,
We can set different colors for the bars based on the selected theme. We have attached our sample browser demonstrating this functionality. As you can see, the fill color of the bars changes according to the theme selection using the pointRender event.
Code-snippet:
|
public pointRender(args: IPointRenderEventArgs): void { let pointMaterialColors: string[] = [ '#00bdae', '#404041', '#357cd2', '#e56590', '#f8b883', '#70ad47', '#dd8abd', '#7f84e8', '#7bb4eb', '#ea7a57', '#404041', '#00bdae', ]; let selectedTheme: string = 'bootstrap5'; selectedTheme = selectedTheme ? selectedTheme : 'Fluent2'; if (selectedTheme === 'material-dark') { args.border.color = pointMaterialDarkColors[args.point.index % 10]; } } |
Screenshot:
Sample browser: https://ej2.syncfusion.com/angular/demos/#/bootstrap5/chart/category
Kindly revert us if you have any concerns.
Regards,
Nishanthi