简体   繁体   English

使用mysql表从php创建饼图

[英]Create pie chart from php using mysql table

I have a mysql table like below 我有一个像下面这样的mysql表

buy_trader    qty
--------------------
abc          48000
xyz          40000
pqr          35000
Others       88000

I need to create a pie chart from these values using PHP code. 我需要使用PHP代码从这些值创建饼图。 Can someone please help me with this. 有人可以帮我这个。 I need to show the percentages of qty out from the total value in the pie chart. 我需要从饼图中的总值中显示数量的百分比。

please help me with this 请在这件事上给予我帮助

You could generate an image of the chart from the command line using sqlchart http://www.sqldashboards.com/sqlchart#example-charts allows generating a pie chart straight from your mysql query like so: sqlchart --host dbserver --servertype mysql --user ryan --pass 123abc --chart piechart --execute "select * from tbl" 您可以使用sqlchart从命令行生成图表的图像http://www.sqldashboards.com/sqlchart#example-charts允许直接从您的mysql查询生成饼图,如下所示: sqlchart --host dbserver --servertype mysql --user ryan --pass 123abc --chart piechart --execute "select * from tbl"

In fact this is how it would look: 事实上这就是它的样子: sql数据饼图

Some more "charting" libraries what you can work with: Chart.Js AmCharts 您可以使用的更多“图表”库: Chart.Js AmCharts

And I found an article , too about it. 我发现了一篇关于它的文章

(Edit: Formating) (编辑:格式化)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM