Python uses Pygal to draw data graphs and monitor charts 2014-03-18 09:44:14 Tags: python charts python monitor graph Python graphics python data show copyright statement: Original works, declined to reprint. Otherwise, legal liability will be held.
Objective:
Tell me about Python drawing the chart. Charts that previously plotted data typically use RRDtool or the front-end chart JS. Let's talk about RRDtool. This thing is very strong, cacti ganglia all use him, but use up some trouble, of course, with familiar after still calculate can, I have been not how to like to use RRDtool, file format some eggs pain, the second is to save into pictures .... Of course, there is a library, can be directly based on URL get parameters, generate pictures, pressure or in the monitoring master end ... The latter JS diagram is much simpler, I server side just provide a timestamp and value of the corresponding relationship. Draw the chart or let the customer use the browser to render it themselves. The pressure is not big, the future expansion is quite good to do, just need to do the library synchronization on the line.
Like me, this is the time to test the Golang Python ssdb reading and writing test, the test program is almost, first find a chart. In the foreign Forum found Pygal, this thing is quite capable and simple, his format is more like a highcharts such as JS Chart.
It's simple to use, you just put the data, go to a place to throw, and then use Pygal directly can see. He is a model of SVG HTML.
Original: http://rfyiamcool.blog.51cto.com/1030776/1378400
Pygal is fairly simple to use:
Titile is the title of the chart
X_labels is the data on the horizontal axis
The rest is master data.
An example of Pygal is an HTML containing SVG chart data.
1 2 3 4 5 6 7 8 9 10 11 12-13 |
Import Pygal Line_chart = Pygal. Line () Line_chart.title = ' Browser usage evolution (in%) ' Line_chart.x_labels = [' 2002 ', ' 2003 ', ' 2004 ', ' 2005 ', ' 2006 ' |