<script type="text/javascript">
//based on dom, prepared to initialize echarts instance
Var myChart=echarts. Init (document. GetElementById (' sxpd1 '));
Var option={
Tooltip: {
The trigger: 'item',
The formatter: "{a} & lt; br/> {b}, {c} ({d} %)
"},
Title: {
Text: 'a certain site users access to source',
Subtext: 'fabrication',
X: 'center'
},
Legend: {
Received: 'vertical',
Show: false,
Left: 'left',
//this article for tips, note the name and the name in the data corresponding
Data: [' video advertising ', 'advertising', 'email marketing, direct access, "search engine", "hackers"]
},
Series: [
{
Name: 'access to source,
Type: 'pie',
The radius: '55%',
Data: [
//remember to add itemStyle property using this method, or you'll find show an error attribute
{value: 335, name: 'direct access to the' itemStyle: {
Normal: {
Label: {
Show: true,
Position: 'inside',
The formatter: '{b}, {c} \ n ({d} %)',
},
LabelLine: {
Show: true
}
}
}},
{value: 310, name: email marketing, itemStyle: {
Normal: {
Label: {
Show: true,
Position: 'inside',
The formatter: '{b}, {c} \ n ({d} %)',
},
LabelLine: {
Show: true
}
}
}},
{value: 234, name: 'union advertising, itemStyle: {
Normal: {
Label: {
Show: true,
Position: 'inside',
The formatter: '{b}, {c} \ n ({d} %)',
},
LabelLine: {
Show: true
}
}
}},
{value: 135, name: 'video ads, itemStyle: {
Normal: {
Label: {
Show: true,
Position: 'inside',
The formatter: '{b}, {c} \ n ({d} %)',
},
LabelLine: {
Show: true
}
}
}},
{value: 1548, name: 'search engines' itemStyle: {
Normal: {
Label: {
Show: true,
Position: 'inside',
The formatter: '{b}, {c} \ n ({d} %)',
},
LabelLine: {
Show: true
}
}
}},
{value: 0, name: 'hackers' itemStyle: {
Normal: {
Label: {
Show: true,
Position: 'inside',
The formatter: '{b}, {c} \ n ({d} %)',
},
LabelLine: {
Show: true
}
}
}}
]
}
]
}
Var opt=option. The series [0];
LineHide (opt);
//data is zero hidden line
The function lineHide (opt) {
JQuery. Each (opt) data, the function (I, item) {
If (item. Value=0) https://bbs.csdn.net/topics/={
Item. ItemStyle. Normal. LabelLine. Show=false;
Item. ItemStyle. Normal. Label. The show=false;
}
});
}
//use the specified configuration items and data display chart,
myChart.setOption(option);
</script>
CodePudding user response:
Why the data will be hidden is not only the hidden text linesCodePudding user response:
Judgment only less than 10 hidden text and lines not hidden data how bosses