Tag:javascript
Article From:https://segmentfault.com/q/1010000012150683
Question:

I set the style in the line, it also removes my code, and its background color is transparent. I want to set the background color in white.
The code is now:

//Initialization of echartsVar myChart = echarts.init (document.getElementById ('main'));/ / the configuration item of the specified chart anddataVar option = {{Grid:{X:35,Y:10},Tooltip: {},XAxis: {Data: ['23:00','24:00','01:00','02:00','03:00','04:00','05:00','06:00','07:00',]},YAxis: {AxisLabel:{/ / / formatter specified scaleFormatter: function (value) {Var texts = [];If (value==0) {Texts.push ('');}Else if (value < =1) {Texts.push ('supine');}Else if (value< = 2) {Texts.push ('dream');}Else if (value< = 3) {Texts.puSh ('shallow sleep');}Else{Texts.push ('deep sleep');}Return texts;}}},/ / prompt box informationTooltip: {Trigger:'axiS',Formatter:function (datas) {Console.log (datas[0].seriEsName);Var sleepVal = '';If (datas[0].value = = 1) {SleepVal = 'supine';}else if (datas[0].value = = 2) {SleepVal = 'dream';}else if (datas[0].value = = 3) {SleepVal = 'shallow sleep';}else if (datas[0].value = = 4) {SleepVal = 'deep sleep';}RetuRN datas[0].name + '-' + sleepVal;}},Series:[1]Name: 'sleep state',Type:'line',Data: [1,1,4,2,3,1,23,4],SymbolSize:7,ItemStyle:{Normal:{Color:'#6eaaee',LineStyle:{COlor:'#FFD700',Width:3}}}}]};/ / use the newly specified configuration items and data to display charts.MyCharT.setOption (option);

Answer 0:


The direct setting is OK
var option = {

grid:...,
tooltip: ...,
...
backgroundColor: #fff

}

Answer 1:

backgroundColor: ‘rgb(255,255,255)’

Leave a Reply

Your email address will not be published. Required fields are marked *