App.component.html:
<ejs-chart
style="display:block"
align="center"
id="chart"
[title]="title"
[primaryXAxis]="primaryXAxis"
[primaryYAxis]="primaryYAxis"
[tooltip]="tooltip"
(load)="load($event)"
(loaded)="loaded($event)"
[chartArea]="chartArea"
[width]="width"
[legendSettings]="legend"
>
<e-series-collection>
<e-series
[dataSource]="data"
type="MultiColoredLine"
xName="x"
yName="y"
name="Rainfall"
width="1.5"
[emptyPointSettings]="emptyPoint"
pointColorMapping="color"
>
</e-series>
</e-series-collection>
</ejs-chart>
App.component.ts:
// add your additional code here
public data: Object[] = [
{ x: new Date(2005, 0, 1), y: 21, color: "blue" },
{ x: new Date(2006, 0, 1), y: 24, color: "blue" },
{ x: new Date(2007, 0, 1), y: null, color: "red" },
{ x: new Date(2008, 0, 1), y: 38, color: "blue" },
{ x: new Date(2009, 0, 1), y: 54, color: "blue" },
{ x: new Date(2010, 0, 1), y: null, color: "red" },
{ x: new Date(2011, 0, 1), y: 70, color: "blue" }
];
public emptyPoint: Object = {
mode: "Average"
};
public loaded(args: ILoadedEventArgs): void {
for (var i = 0; i < args.chart.series[0].dataSource["length"]; i++) {
if (args.chart.series[0].dataSource[i].y == null) {
document
.getElementById("chart_Series_0_Point_" + i)
.setAttribute("stroke-dasharray", "5,5");
}
}
}
// add your additional code here
|
// add your additional code here
public loaded(args: ILoadedEventArgs): void {
for (var i = 0; i < args.chart.series[0].dataSource["length"]; i++) {
if (args.chart.series[0].dataSource[i].y == null) {
document.getElementById(args.chart.element.id + "_Series_0_Point_" + i).setAttribute("stroke-dasharray", "5,5");
}
}
}
// add your additional code here |
// add your additional code here
public loaded(args: ILoadedEventArgs): void {
if (args.chart.series) {
let chartId = args.chart.element.id;
// tslint:disable-next-line: no-any
args.chart.series.forEach(
(element: { dataSource: { y: any }[] }, index: any) => {
console.log('INSIDE FOREACH = ', element);
// tslint:disable-next-line: no-any
element.dataSource.forEach((elem: { y: any }, i) => {
if (elem.y == null) {
console.log(
'DOC = ',
document.getElementById(
chartId + '_Series_' + index + '_Point_' + i
)
);
document
.getElementById(chartId + '_Series_' + index + '_Point_' + i)
.setAttribute('stroke-dasharray', '5,5');
}
});
}
);
}
}
// add your additional code here
|