Perspective Pie chart data not showing from query

Hi connections,


Need to pass the Value form the data base to the pie chart.Bindied the Named query at the Data. But the color is not visible at the Pie chart. I am passing the data through the named query.

Named query.

But not able to get the Data at the Pie chart.

Your data and bindings don't seem valid. Look at the example here:

Perspective - Pie Chart - Ignition User Manual 8.1 - Ignition Documentation (inductiveautomation.com)

I see you have a binding on data, and another on data[1]["quality"]. Those will fight each other.

Refactor your binding on data to return something like this:

[
   {"quality":"Good", "count":88},
   {"quality":"Bad", "count":12}
]

[
{"quality":"Good", "count":88},
{"quality":"Bad", "count":12}
]

This script exactly where needs to Execute.

post your query here using the formated text </>
so we can help

DECLARE @ET Datetime
DECLARE @ST Datetime

SET @ET = (select convert(DATETIME, :EndDate, 121))
SET @ST = (select convert(DATETIME, :StartDate, 121))

SELECT AVG([Performance]) as performance
FROM [OKUMA].[dbo].[OEE_DATA]
where [TIMESTAMP] >= @ST and [TIMESTAMP] <= @ET

The abovementioned is the Query.

are you sure this is the query?

Your output is quality, while your query says performance...
anyways you need 2 selects.
one for the type/label
and one for the value/count

okay.
performance and quality have same query.

You are only returning one column. You need two.

SELECT 'performance' as key, AVG([Performance]) as value
FROM [OKUMA].[dbo].[OEE_DATA]
where [TIMESTAMP] >= @ST and [TIMESTAMP] <= @ET


Value Getting Updated in the Designer but While Opened in the Browser Not able Update showing default 100%.

Your query returns one row of data. You need two.

Also, I neglected that 'key' is a keyword in my last post, so I changed the column alias.

You can do this by calculating in your query, then doing an unpivot.

SELECT keyName, val
FROM (SELECT AVG([Performance]) as performance, 100-AVG([Performance]) as ad
      FROM [OKUMA].[dbo].[OEE_DATA]
      WHERE [TIMESTAMP] >= @ST and [TIMESTAMP] <= @ET) t
UNPIVOT
    (val for keyName in (performance, ad)) u

Example:

SELECT keyName, val
FROM (select 35 as performance, 65 as ad) t
UNPIVOT( val for keyName in (performance, ad)) u

Returns:
image

Seeing these screenshots, it looks like you don't want a pie chart. Maybe a simple gauge is better suited?

Perspective - Simple Gauge - Ignition User Manual 8.1 - Ignition Documentation (inductiveautomation.com)

Thank you JordanC Clark its working fine.