Echart1.4.1
If it is the latest 2.2.7, you can refer to the website provided by Http://echarts.baidu.com/doc/example/bar15.html
If it is 1.4.1, then if the function (params) is written in color, the params does not have so many parameters to the 2.2.7, and if the color changes with the value, this can be done
var Zrcolor = require (' Zrender/tool/color ');
var colorno=0;//set Column chart function Setcolumnchart (x_value,y_value,colorbegin,colorend) {option_column.xaxis[0].data=x_ value;option_column.series[0].data=y_value;option_column.series[0].itemstyle.normal.color= function (params) {// Gets the array of gradient colors between the two colors var colorlist = zrcolor.getstepcolors (colorbegin,colorend, 100);//Gets the number of values in the array var item=parseint (y_value[ Colorno]) var curcolor=colorlist[item];//is used to iterate through the numeric array colorno++;//the completion value, reset the control variable if (colorno==y_value.length) {colorno=0 ;} return curcolor; } Mychart_column.setoption (Option_column); }
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Solve the problem of Echart (1.4.1) column chart not changing color with value