guys i have been asked to create a few Apache E-charts. the way i am doing it copy paste the whole code everytime pass the values i want and render the chart in the screen.
the problem is that if i have 10 charts on the screen then i have 10 blocks of code. one for each chart. therefore i am trying to create a method and every-time i need a chart call the method pass the values i want and render it to the screen.
here is what i have done:
then i call the method like this:
the problem i have is with the name of the chart - this.myPieChart6
i cant pass a parameter that everytime changes the name of the chart.
i dont want all the charts to have the same same- this.myPieChart6
i want to be able to differentiate them...
how i do that ?? any ideas?
the problem is that if i have 10 charts on the screen then i have 10 blocks of code. one for each chart. therefore i am trying to create a method and every-time i need a chart call the method pass the values i want and render it to the screen.
here is what i have done:
JavaScript:
callTheMethod(titleText:String,titleButest:String,){
// console.log("hi" + name +"your surname is"+ surname)
this.myPieChart6 = {
title: {
text: titleText,
subtext: titleButest,
left: 'center'
},
tooltip: {
trigger: 'item'
},
legend: {
orient: 'vertical',
left: 'left'
},
series: [
{
name: 'Access From',
type: 'pie',
radius: '50%',
data: [
{ value: 40, name: 'Internal' },
{ value: 44, name: 'External' },
{ value: 40, name: 'Int/Ext' },
{ value: 32, name: 'Unclassified' }
],
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
]
};
}
then i call the method like this:
Code:
callTheMethod("my chart","this is a subtitle",)
the problem i have is with the name of the chart - this.myPieChart6
i cant pass a parameter that everytime changes the name of the chart.
i dont want all the charts to have the same same- this.myPieChart6
i want to be able to differentiate them...
how i do that ?? any ideas?