Echart is an open source information chart library based on JavaScript. It mainly provides data visualization functions. What is data visualization? Data visualization means to present the required data in the form of charts, such as bar charts, line charts, pie charts, etc. that are often used in our daily lives. They are all methods of data visualization. //Create a container to put the chart in the HTML page <div style=”width: 500px;height:400px><div> Create Echart entity var chart = echart.init( document.getElementByd('main')); //Set chart options and data var option = { title: { text='line chart' }, tooltip:{}, xAxis:{ data:{'Monday','Tuesday', 'Wednesday','Thursday', 'Friday ', 'Saturday', 'Sunday'}, xAxis:{}, series : [{ name: 'Quantity', type: 'line' data: [8,42,65,84,156,56,45] }] }; //Bring the chart options set by the variable option into echart to implement the chart Chart.setOption(option); Next, we will introduce the object methods and properties commonly used in ECharts.
1.echart.init(document.getElementByd('main')); This method can initialize Echarts, taking the DOM node in HTML as a parameter to initialize the container, so that Echart can thailand whatsapp phone number generate charts. 2.option{…} The object that determines how the chart is generated can be used to set the chart's title, x-axis, y-axis, data in the chart, etc. It is an object that must be implemented in echart. 3.Option.title It is an object responsible for setting the chart title. It contains many attributes.
Common ones include: text: Text in the chart title. textStyle: This is also an object responsible for rendering title text. The properties are usually used to set color, size, font, etc. show: Used to decide whether to display the title. link: link to the title. target: Determines how the window will be opened after clicking the title link. 'self' is opened in the current window 'blank' opens in a new window 4.yAxis is used to set the y-axis of the chart: 4.1 type: coordinate axis type, there are four attributes that can be used.