"type": "米面", "value": 11000 }, { "city": "上海", "type": "特产零食", "value": 15000 }, { "city": "上海", "type": "茶叶", "value": 14000 }] column = Plot('Column') column.set_options({ "appendPadding": 32, "data": data, "xField": "city", "yField": "value", "seriesField": "type", "isGroup": True, "columnStyle": { "radius": [20, 20, 0, 0], }, "legend": { "position": "top" } }) put_html(column.render_notebook())
dualAxes = Plot("DualAxes") dualAxes.set_options({ "appendPadding": 32, "data": [data1, data2], "xField": "time", "yField": ["value", "count"], "legend": { "position": "top", }, "geometryOptions": [ { "geometry": "line", "seriesField": "type", "lineStyle": { "lineWidth": 3, "lineDash": [5, 5], }, "smooth": True, }, { "geometry": "column", "seriesField": "name", "isStack": True, }, ], }) put_html(dualAxes.render_notebook())
# -*- coding: UTF-8 -*- ''' Date: 2021-04-22 22:49:56 ''' from pyg2plot import Plot column0 = Plot("Column") column0.render_notebook()
from pyg2plot import Plot from pywebio.output import put_html liquid = Plot("Liquid") liquid.set_options({ "appendPadding": 32, "percent": 0.25, "outline": { "border": 4, "distance": 4, }, "wave": { "length": 128, }, }) put_html(liquid.render_notebook())
gauge.set_options({ "appendPadding": 32, "percent": 0.75, "range": { "ticks": [0, 1 / 3, 2 / 3, 1], "color": ["#F4664A", "#FAAD14", "#30BF78"], }, "indicator": { "pointer": { "style": { "stroke": "#D0D0D0", }, }, "pin": { "style": { "stroke": "#D0D0D0", }, }, }, "statistic": { "content": { "style": { "fontSize": "36px", "lineHeight": "36px", }, }, }, }) put_html(gauge.render_notebook())
{ "year": '1999', "value": 13 }, ] line = Plot("Line") line.set_options({ "appendPadding": 32, "data": data, "xField": "year", "yField": "value", "label": {}, "smooth": True, "lineStyle": { "lineWidth": 3, }, "point": { "size": 5, "shape": 'diamond', "style": { "fill": "white", "stroke": "#5B8FF9", "lineWidth": 2, } } }) put_html(line.render_notebook())
from pyg2plot import Plot from pywebio.output import put_html data = [ { "type": "分类一", "value": 27 }, { "type": "分类二", "value": 25 }, { "type": "分类三", "value": 18 }, { "type": "分类四", "value": 15 }, { "type": "分类五", "value": 10 }, { "type": "其他", "value": 5 }, ] pie = Plot("Pie") pie.set_options({ "appendPadding": 32, "data": data, "angleField": "value", "colorField": "type", "radius": 0.8, "label": { "type": "outer", }, "interactions": [{ "type": "element-active" }], }) put_html(pie.render_notebook())
"r(0.4, 0.4, 0.7) 0:rgba(255,255,255,0.5) 1:#61DDAA", ], "sizeField": "size", "size": [5, 20], "shape": "circle", "yAxis": { "nice": True, "line": { "style": { "stroke": "#eee", }, }, }, "xAxis": { "grid": { "line": { "style": { "stroke": "#eee", }, }, }, "line": { "style": { "stroke": "#eee", }, }, }, }) put_html(scatter.render_notebook())
"date": 2014, "value": 5382.9 }, { "country": "亚太地区", "date": 2015, "value": 5472.4 }, { "country": "亚太地区", "date": 2016, "value": 5585.5 }, { "country": "亚太地区", "date": 2017, "value": 5743.6 }] area = Plot("Area") area.set_options({ "appendPadding": 32, "data": data, "xField": "date", "yField": "value", "seriesField": 'country', "legend": { "position": "top" } }) put_html(area.render_notebook())