Component.html:
<button id='click' (click)='onChange($event)'>Click</button>
<div id="multiple-donut" style="height:330px">
<div class="column-chart" id="steps-donut" style="height:330px">
<ejs-accumulationchart #multiplepie style='height: 330px; margin-bottom: 0px' (loaded)='steploaded($event)'>
</ejs-accumulationchart>
</div>
</div>
Component.ts:
public onChange() {
this.pie.annotations = [
{
content: '<div id="container1" style="width:330px; height:330px;">',
region: "Chart",
x: "50%",
y: "50%"
},
{
content: '<div id="container2" style="width:280px; height:280px;">',
region: "Chart",
x: "50%",
y: "50%"
}
];
this.pie.refresh();
}
public steploaded(args: ILoadedEventArgs): void {
let length = args.chart.annotations ? args.chart.annotations.length : 0;
let id: string = '';
for (let i = 0; i < length; i++) {
id = 'container' + (i + 1);
let innerRadius = (80 - i*10) + '%';
let radius = (75 - i*10) + '%';
this.annotationpie1 = new AccumulationChart({
// Initialize the chart series
series: [
{
dataSource: this.annotationpie1data,
palettes: ["#4F7305", "LightGrey"],
radius: radius,
xName: "x",
yName: "y",
startAngle: 180,
endAngle: 180,
innerRadius: innerRadius,
name: "Project",
explode: false,
explodeOffset: "10%"
}
],
loaded: (args: IAccLoadedEventArgs) => {
if (document.getElementById(id + "_border")) {
document.getElementById(id + "_border").style.fill =
"transparent";
}
}
});
this.annotationpie1.appendTo("#" + id);
} |
public load(args: ILoadEventArgs): void {
let annotations = [];
let datasource = args.accumulation.series[0].dataSource;
let size = 480;
for (let i = 0; i < datasource.length; i++) {
size = size - i*100;
annotations.push({
content: '<div id="container'+ (i+1)+'"' + 'style="width:' + size + 'px; height:' +size + 'px;">',
region: "Chart",
x: "50%",
y: "50%"
});
}
args.accumulation.annotations = annotations;
}
public steploaded(args: ILoadedEventArgs): void {
let length = args.chart.annotations ? args.chart.annotations.length : 0;
let id: string = "";
for (let i = 0; i < length; i++) {
id = "container" + (i + 1);
let innerRadius = 65 + (i*5) + "%";
let radius = 60 + i + "%";
this.annotationpie1 = new AccumulationChart({
// Initialize the chart series
series: [
{
dataSource: this.annotationpie1data,
palettes: [this.color[i], "LightGrey"],
radius: radius,
xName: "x",
yName: "y",
startAngle: 180,
endAngle: 180,
innerRadius: innerRadius,
name: "Project",
explode: false,
explodeOffset: "10%"
}
],
enableSmartLabels: true,
legendSettings: {
visible: false,
position: "Top"
},
// Initialize the tooltip
tooltip: { enable: false },
loaded: (args: IAccLoadedEventArgs) => {
if (document.getElementById(id + "_border")) {
document.getElementById(id + "_border").style.fill = "transparent";
}
}
});
this.annotationpie1.appendTo("#" + id);
}
} |