nodejs knowledge point

2023-03-16  

Here is a cake chart as an example

First modify this

Just modify the formatter under Tooltip to code as follows:

Tooltip: { 
 trigger: 'item', 
 // formatter: "{a} <br/> {b}: {c} ({d}%)" " 
 Formatter: Function (data) { 
 Return data.seriesname + '<br/>' + data.name.split ('fenge') [1] + ':' + (data.value/allcount*100) .tofixed (2) + '%';/ /Turn the decimal to a percentage display 
 } 
 },

PS: The host of the number of times I don’t know how to get it, add it by myself

The next one on the right

legend: {
	orient: 'vertical',
	right: 'right',
	formatter: function (name) {
		return (name.split('fenge')[1].length > 8 ? (name.split('fenge')[1].slice(0,8)+"...") : name.split('fenge')[1] ); 
	},
	data: type_colore
},

Last is around the graphic

Series: [{{ 
 name: 'This product', 
 Type: 'Pie', 
 radius: '55%', 
 Center: ['50%', '50%'], 
 data: data_colore, 
 color: ['#eeb422', '#483d8b', '#cd661d', '#6b8e23', '#5F9EA0'], 
 
 itemStyle: {{ 
 normal: {{ 
 label: {{ 
 Formatter: Function (name) { 
 Return (name.name.split ('feen "[1] .Length> 10? .name.split ('fenge') [1]); 
 } 
 }, 
 labelline: {{ 
 show: false 
 } 
 }, 
 EMPHASIS: { 
 shadowblur: 6, 
 shadowoffsetx: 0, 
 Shadowcolor: 'RGBA (0, 0, 0, 0.5)' 
 } 
 } 
 }]

The landlord has a demand here. Click a certain piece in the chart to display the corresponding content, so you need to use ID,

I couldn’t think of a good way, I passed the ID and the name together in the background, but the ID could not be displayed.

Below is the code for adding a click event to the corresponding module:

Function econsole (param) { 
 Alert (param.name); // The name at the click 
     alert (param.value); // The value at the click 
 Alert (Param.DataDex); // Get the current click index 
 } 

 MyChart.on ("click", Econsole);

source

Related Posts

ListView uses the getView problem NEO

Detailed explanation of the implementation of Call, Apply, and Bind in JS (source code implementation)

[python] [Original] OpenCV reads the camera or video template code

wgs84 Earth coordinate system, GCJ02 Mars coordinate system, BD09 Baidu coordinate system profile and conversion

nodejs knowledge point

Random Posts

jquery实现简单收缩菜单

java-Java.sql.sqlexception: Unable to load authentication plugin ‘cachingSha2Password‘.

“Programmer Installation B Guide”

Hangdian ACM2089 Do not 62JOHN

MySQL8.0.26 Installation Tutorial (Super Simple)