question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pie Chart with MySQL datasource

See original GitHub issue

Hi,

I want to create simple Pie Chart with MySQL datasource.

I use two simple querys: SELECT SUM(amount) as Monthly FROM tblhosting WHERE domainstatus = 'active' and billingcycle = 'Monthly'; SELECT SUM(amount)/12 as Annually FROM tblhosting WHERE domainstatus = 'active' and billingcycle = 'Annually';

When I try create Table with this querys it works fine. But when try the same with “Pie Chart” I got error: undefined is not an object (evaluating 'this.datapoints.length')

Query Inspector:

xhrStatus:“complete”
request:Object
method:“POST”
url:“api/tsdb/query”
data:Object
from:“1525941113670”
to:“1525962713671”
queries:Array[2]
response:Object
results:Object
A:Object
refId:“A”
meta:Object
rowCount:1
sql:“SELECT SUM(amount) as Monthly FROM tblhosting WHERE domainstatus = ‘active’ and billingcycle = ‘Monthly’;”
series:null
tables:Array[1]
B:Object
refId:“B”
meta:Object
rowCount:1
sql:“SELECT SUM(amount)/12 as Annually FROM tblhosting WHERE domainstatus = ‘active’ and billingcycle = ‘Annually’;”
series:null
tables:Array[1]
0:Object

6d733f03e74c20abb1bd42748310bd0ef49629d1_1_690x298 1111

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:10
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

12reactions
marefrcommented, Jul 23, 2018

@itayB will provide an example, but recommend you to have a look at Grafana’s community site which is more suitable for questions.

Using latest Grafana (5.3-pre1)

SELECT
  now() as time_sec,
  count(value),
  measurement
FROM 
  grafana_metric
GROUP BY 3

Generates the following without any other options specified:

image

6reactions
marefrcommented, Jul 5, 2018

The piechart panel only works with time series data which means that you’ll need to select a time_sec column in your query for the time - you should be able to use now() to return the same time for all your rows .

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pie Chart using data from MySQL table by PHP - Plus2net
Pie Chart using data from MySQL table by PHP ; config.php, MySQLi Database connection details are stored here. ; sql_dump.txt, SQL Dump to...
Read more >
Pie Chart with data from MySQL database table using PHP ...
Part 1 of this tutorial we discussed about how to use google chart library to draw a pie chart with different options.
Read more >
Pie Chart with MySQL datasource - Configuration
Hi, guys! I want to create simple Pie Chart with MySQL datasource. I use two simple querys: SELECT SUM(amount) as Monthly FROM tblhosting ......
Read more >
How To Create A Pie Chart In PHP And MySQL - FusionCharts
When it comes to creating a PHP pie chart, you can obtain the data for the chart statically by defining the data during...
Read more >
How to fill Pie chart with datas from MySql Datas
import numpy as np import matplotlib.pyplot as plt a = np.array([[44], [23], [25], [39], [34], [20], [44], [31], [32], [42]], ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found