Echarts Chart Intermediate Entry formatter: Implausible data formatting methods in Echarts charts

Source: Internet
Author: User

Article Source: http://www.stepday.com/topic/?834

The reason why formatting exists, mainly because we want to put some human content is not enough to make it humanized, so that users better understand the content. Echarts formatting methods within a Chart Component formatter there are some differences between the formatting methods in the Highcharts Chart component, there is no comparison between them. Echarts formatting within a Chart component The usual places are not many, so come and have a look.

A. tooltip

The hover box of the data points in the chart when the information is displayed, we can format the data to make it easier to observe the data and analyze the data.

For example, you need to append the value of the current data point to a single unit string, as shown in the example code: View Source print? ToolTip: {trigger: ' axis ', formatter:function (a) 04. {relval var = ""; Relval = a[0]+ "°c<br/>"; . relval + = a[1]+ "°c"; . return relval; 09.} 10. },

The renderings are as follows:

If you are not familiar with the parameters within the formatter method, you can set debugger in function to debug the browsing data structure by adding breakpoints.

Second, AxisLabel

Scale formatting on the axis scale, such as a very simple example, the y-axis represents a person's weight, we often need to take a unit of kg behind each tick value, how should we format the scale?

The sample code for formatting the y-axis scale is as follows: View source print? YAxis: [02. {. Type: ' Value ', AxisLabel: {formatter:function (value) 06. {. Return value+ "kg"; 08.} 09. },

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.