Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to use Element to display histogram in python

Shulou Source: shulou.com Published: 2022-06-02 10:39:09 10月02日 Update

Today, I will talk to you about how to use Element to display bar charts in python, many people may not know much about it. In order to make you understand better, the editor has summarized the following contents for you. I hope you can get something according to this article.

1. Front-end HTML and CSS alarm events TOP 5 device class Type An alarm TOP 52. Frontend JS new Vue ({el:'# app', data: {fullscreenLoading: false}, mounted () {/ / page load and get all templates this.init ()}, methods: {init () {this.fullscreenLoading = true) Axios.get (site_url + "top5_data/") .then (res = > {if (res.data.result) {this.fullscreenLoading = false; this.chart1 = echarts.init (document.getElementById ('chart1') This.chart1.setOption ({tooltip: {trigger: 'axis', axisPointer: {/ / axis indicator Axis triggers valid type: 'shadow' / / defaults to straight line Optional: 'line' |' shadow'}}, grid: {left:'3%', right:'4%' Bottom:'3% floor, containLabel: true} XAxis: [{type: 'value'}] YAxis: [{type: 'category', data: res.data.data.top5_title_res.title_list AxisTick: {alignWithLabel: true}}] Series: [{number of name:'', type:'bar', barWidth:'40%' Data: res.data.data.top5_title_res.count_list}]}) This.chart2 = echarts.init (document.getElementById ('chart2')) This.chart2.setOption ({tooltip: {trigger: 'axis', axisPointer: {/ / axis indicator Axis triggers valid type: 'shadow' / / defaults to straight line Optional: 'line' |' shadow'}}, grid: {left:'3%', right:'4%' Bottom:'3% floor, containLabel: true} XAxis: [{type: 'value'}] YAxis: [{type: 'category', data: res.data.data.top5_device_type_res.type_list AxisTick: {alignWithLabel: true}}] Series: [{number of name:'', type:'bar', barWidth:'40%' Data: res.data.data.top5_device_type_res.count_list}]}) } else {this.fullscreenLoading = false; this.$message.error ('request failed')}}, 'json');}}) 3.Django code

Top5_data/ API returns data

{"top5_title_res": {"count_list": [18268, 18273, 18309, 30361, 30398], "title_list": ["1.18.6.11 process port alarm", "1.18.6.20 process port alarm", "1.18.6.13 process port alarm" "1.18.6.18 process port alarm", "1.18.6.9 process port alarm"]}, "top5_device_type_res": {"type_list": ["CPU", "memory", "hard disk", "basic alarm", "port"], "count_list": [16029 24217, 51166, 140975, 170223]}}

Realize the effect

After reading the above, do you have any further understanding of how to use Element to display bar charts in python? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Tags: Port process coordinate axis content column valid front end indicator indicator quantity straight line central processing unit event code memory processor interface effect Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker Shulou Tech Info Huawei Linux Xiaomi