Home > front end >  Echarts dynamic change line styles, graphics.linestyle doesn't work
Echarts dynamic change line styles, graphics.linestyle doesn't work

Time:10-20

I want a random number to 1 set the style of a line, in the style of the zero set another line, but the overall effect is not the case, the HTML code is as follows, please god help see



<script>
The import echarts from 'echarts'
Export the default {
Name: 'about',
Mounted () {
. Let the tree=echarts init (document. GetElementById (" tree "));
Let the option=this. GetOption ();

SetInterval (function () {
Let aa=Math. Floor (Math. The random () * 2)

The console. The log (aa);

If (aa==0) {
Option. The series [0]. Data [0]. Children [0]. Graphics.linestyle={
Color: '# ff0000'
}
} else {
Option. The series [0]. Data [0]. Children [0]. Children [0]. Graphics.linestyle={
Color: '# 0000 ff'
}
}

Tree. SetOption (option)
}, 3000)
},
Methods: {
GetOption () {
Let the option={
Series: [{
Type: 'tree',
Left: '2%',
Right: '2%',
Top: '10%',
Bottom: '10%',
AnimationDurationUpdate: 750,
Received: 'vertical',

Data: [{
Name: 'test',
Children: [{
Name: 'child',
Children: [{
Name: 'test bottom'
}, {
Name: '2',

}

]
}]
}]
}]
}

The return option;
}
},

}
</script>

CodePudding user response:

How much is the building Lord Echarts reference version of
Very different from the corresponding version of graphics.linestyle attribute
Under the V2 V4 color attributes are in series graphics.linestyle
V3 color attributes are in series lineSyle under normal

CodePudding user response:

reference 1st floor Clinging_white response:
the original poster Echarts reference version is how much
Very different from the corresponding version of graphics.linestyle attribute
Under the V2 V4 color attributes are in series graphics.linestyle
V3 color attributes are in series lineSyle under normal


Thank you for your reply, my version v4, be such, as long as it's not in the timer, will take effect, but I'm needs to randomly generated color lines

CodePudding user response:

refer to the second floor in Athens, Gerhardt reply:
Quote: refer to 1st floor Clinging_white response:

How much is the building Lord Echarts reference version of
Very different from the corresponding version of graphics.linestyle attribute
Under the V2 V4 color attributes are in series graphics.linestyle
V3 color attributes are in series lineSyle under normal


Thank you for your reply, my version v4, be such, as long as it's not in the timer, will take effect, but demand is randomly generated I add color line

Console is there an error message of what can be the inside of the timer option

CodePudding user response:

Get along while, found the guy only changes the color of the line will not refresh, you can manually click the nodes to achieve the purpose of updating shrinkage, can also modify other attributes to refresh at the same time, such as modified name:
 
Option. The series [0]. Data [0]. Children [0]. Name=option. The series [0]. The data [0]. Children [0]. Name + "';
MyChart. SetOption (option, true, false);
Option. The series [0]. Data [0]. Children [0]. Name=option. The series [0]. The data [0]. Children [0]. Name the substring (0, option. The series [0]. The data [0]. Children [0]. Name. The length - 1);
MyChart. SetOption (option, true, false);

CodePudding user response:

Hello World reference 4 floor, response:
get along while, found the guy only changes the color of the line will not refresh, you can manually click on the nodes to achieve the purpose of updating shrinkage, can also modify other attributes to refresh at the same time, such as modified name:
 
Option. The series [0]. Data [0]. Children [0]. Name=option. The series [0]. The data [0]. Children [0]. Name + "';
MyChart. SetOption (option, true, false);
Option. The series [0]. Data [0]. Children [0]. Name=option. The series [0]. The data [0]. Children [0]. Name the substring (0, option. The series [0]. The data [0]. Children [0]. Name. The length - 1);
MyChart. SetOption (option, true, false);



Oh, that would not satisfy the demand, don't know is there any way to achieve this in a timely manner to modify

CodePudding user response:

CodePudding user response:

The
Hello World reference 6 floor, response:


Hello, the effect how

CodePudding user response:

reference Clinging_white reply: 3/f
Quote: refer to the second floor in Athens, Gerhardt reply:

Quote: refer to 1st floor Clinging_white response:

How much is the building Lord Echarts reference version of
Very different from the corresponding version of graphics.linestyle attribute
Under the V2 V4 color attributes are in series graphics.linestyle
V3 color attributes are in series lineSyle under normal


Thank you for your reply, my version v4, be such, as long as it's not in the timer, will take effect, but demand is randomly generated I add color line

Console is there an error message of what can be the inside of the timer option problems


Without error, is unlikely to be echarts does not support

CodePudding user response:

reference 7 building in Athens, Gerhardt reply:
Quote: refer to the sixth floor Hello World, response:



nullnull
  • Related