Home > other >  About all configuration items in pyecharts command calls yes object name should be how to write?
About all configuration items in pyecharts command calls yes object name should be how to write?

Time:01-28

Teachers

When I was at the pyecharts document encounter a problem, as follows:

For example: LabelOpts: configuration TAB
Official document only tell me: class pyecharts. Options. LabelOpts
The class LabelOpts (
Whether # show labels,
Is_show: bool=True,

# label position, optional
# 'top' and 'left', 'right' and 'bottom' and 'inside' and 'insideLeft', 'insideRight'
# 'insideTop', 'insideBottom', 'insideTopLeft', 'insideBottomLeft'
# 'insideTopRight', 'insideBottomRight'
Position: the Union [STR, Sequence]="top",

The color of the # characters,
# if set to 'auto', is a visual map of colors, such as a series of color,
Color: Optional STR=None,
.

Such as usage, but didn't tell me label_opts=opts. LabelOpts, before I opts LabelOpts "label_opts
"Include a variety of other commands, I don't know the names of the objects before the "=" should be how to write,
Do you know how to check, or have written rules?

CodePudding user response:

Pyecharts site demonstration code, like this,

 

The from pyecharts. Charts the import Line
The from pyecharts import options as opts
Data_x=[' 20200306 ', '20200307', '20200308', '20200309', '20200310', '20200311', '20200312')
Data_y=[' 18.51% ', '17.11%', '18.67%', '16.61%', '16.74%', '17.55%', '17.18%']
Data_y_0=[float (x.s trip (' % ')) for x in data_y]

The line=(
The Line ()
. Add_xaxis (data_x)
Add_yaxis (" bandwidth utilization, "data_y_0, label_opts=opts. LabelOpts (formatter=" {c} % "))
Set_global_opts (
Yaxis_opts=opts. AxisOpts (axislabel_opts=opts. LabelOpts (formatter="{value} %")))
)
Line. The render ()

CodePudding user response:

Thank you answer upstairs, maybe I didn't express clearly,

I mean, if I want to use a set of pyecharts command,
But the API documentation of pyecharts notes only tell me XXX. XxxOpts usage of the the parameters in parentheses (),
The specific call is: yyy_opts=XXX. XxxOpts (),
Documents didn't tell me in front of the yyy_opts should be how to write,
Because some Settings command online didn't find relevant instances,

Like "yaxis_opts=opts. AxisOpts (axislabel_opts=opts. LabelOpts (formatter=" {value} % ")) "
Part "axislabel_opts" which did not say to in the API documentation, if no instance on the Internet, how can I find,
=opts. LabelOpts should write "axislabel_opts" before (),

CodePudding user response:

Feel the need to do parameter Settings, typically appearance size, title, subtitle, graphic, axis, the second axis, property characteristics of figure
Feel pyecharts official documentation is not rich, I am see examples of official documentation, use that figure, sent the examples of the graphics look again (now every figure less have 3, 4, for example, more than ten several examples), basic enough, example with parameter Settings, just change a try, if there is no corresponding parameters, is research echarts parameters, through

Opts. LabelOpts (formatter=JsCode (" function (params) {return params. Value [1] + '%'} "))

This way of directly modify echarts to complete, is don't weigh in hand, contact pyecharts project
  • Related