<! Doctype HTML>
<Head>
<Meta charset = "gb2312">
<Title> echarts </title>
</Head>
<Body>
<! -- Reference the echarts file -->
<SCRIPT src = "echarts-plain.js" data-Ke-src = "echarts-plain.js"> </SCRIPT>
<! -- Prepare a Dom with the size (width and height) for echarts -->
<Div id = "Main" style = "height: 400px"> </div>
<SCRIPT type = "text/JavaScript">
Function MYD (){
// Initialize the echarts Chart Based on the prepared dom
VaR MyChart = echarts. INIT (document. getelementbyid ('main '));
VaR option = {
Title :{
Text: 'user access source of a website ',
Subtext: 'purely fictitious ',
X: 'center'
},
Tooltip :{
Trigger: 'item ',
Formatter: "{A} <br/> {B }:{ c} ({d} % )"
},
Legend :{
Orient: 'signature ',
X: 'left ',
Data: ['direct access', 'email marketing ', 'Alliance ads', 'video ads', 'search engine']
},
Toolbox :{
Show: True,
Feature :{
MARK: {Show: true },
Dataview: {Show: True, readonly: false },
Restore: {Show: true },
Saveasimage: {Show: true}
}
},
Calculable: True,
Series :[
{
Name: 'Access source ',
Type: 'pie ',
RADIUS: '123 ',
Center: ['20160301', '20160301'],
Data :[
{Value: 335, name: 'direct access '},
{Value: 310, name: 'directmail '},
{Value: 234, name: 'Alliance ads '},
{Value: 135, name: 'video ads '},
{Value: 1548, name: 'searchengine '}
]
}
]
};
// Load data for the echarts object
MyChart. setoption (option );
}
</SCRIPT>
<A href = "javascript: MYD ()"> dddd </a>
</Body>
This article from the "Su Yan" blog, please be sure to keep this source http://suyanzhu.blog.51cto.com/8050189/1562157
Echarts-Quick Start