Home > other >  Pyecharts Y why add more lines and set the color is not the same?
Pyecharts Y why add more lines and set the color is not the same?

Time:11-26

Recently in learning to use pyecharts drawing, some problems encountered in the process of drawing multiple axes,
I use. Add_yaxis () at the same time, set the color of color, but the generated chart data line color is different from the set, seemingly opposite, but the color of the coordinate axes is right, there are bosses know what reason be?



 
The import pyecharts. The options as opts
The from pyecharts. Charts the import Line
The from pyecharts. Faker import faker

The line=(
The Line (init_opts=opts. InitOpts (width="1800 px", height="800 px"))
Add_xaxis (Faker. Choose ())
Add_yaxis (
Series_name="red" red,
Y_axis=Faker. Values (),
Yaxis_index=0,
Color="red", add a red # data
)
Add_yaxis (
Series_name="green green",
Y_axis=Faker. Values (),
Yaxis_index=1,
Color="green", # to add a green data
)
Add_yaxis (
Series_name="yellow yellow",
Y_axis=Faker. Values (),
Yaxis_index=2,
Color="yellow", # add a yellow data
)
Add_yaxis (
Series_name="blue blue",
Y_axis=Faker. Values (),
Yaxis_index=3,
Color="blue", # to add a blue data
)
Add_yaxis (
Series_name="gray gray",
Y_axis=Faker. Values (),
Yaxis_index=4,
Color="Gray", # add a grey data
)

Extend_axis (# extend out a coordinate axis
Yaxis=opts. AxisOpts (
Type_="value",
Name="green green",
The position="right",
Offset=0,
Axisline_opts=opts. AxisLineOpts (linestyle_opts=opts. LineStyleOpts [color="green")),
)
)
Extend_axis (# extend out a coordinate axis
Yaxis=opts. AxisOpts (
Type_="value",
Name="yellow yellow,"
The position="right",
Offset=50,
Axisline_opts=opts. AxisLineOpts (linestyle_opts=opts. LineStyleOpts [color="yellow")),
)
)
Extend_axis (# extend out a coordinate axis
Yaxis=opts. AxisOpts (
Type_="value",
Name="blue" blue,
The position="right",
Offset=100,
Axisline_opts=opts. AxisLineOpts (linestyle_opts=opts. LineStyleOpts [color="blue")),
)
)
Extend_axis (# extend out a coordinate axis
Yaxis=opts. AxisOpts (
Type_="value",
Name="gray gray,"
The position="right",
Offset=150,
Axisline_opts=opts. AxisLineOpts (linestyle_opts=opts. LineStyleOpts [color="gray")),
)
)

Set_global_opts (
Yaxis_opts=opts. AxisOpts (
Type_="value",
Name="red" red,
Axisline_opts=opts. AxisLineOpts (linestyle_opts=opts. LineStyleOpts [color="red")),
),
)
)

Line. Render (" test. HTML ")
  • Related