In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
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.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.