cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

How to make the bar chart to be displayed for 7 days as a limit instead of getting all data?

NH_shree
12-Amethyst

How to make the bar chart to be displayed for 7 days as a limit instead of getting all data?

Hello,

 

I am using thing Worx 9.3.0 version , I want to display the 7 days data on the bar chart , whether it may be recent 7 days or any when I select the start date to end date only that data should get displayed in the mashup ,

 

As of now my mashup bar chart is having data from last 2 years so I need to make the chart which can be selected and viewed according to dates instead of all data 

 

please help me what needs to be done  , if anyone have some ideas on this 

 

Regards,

Shree 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @NH_shree 

 

You can create a service with dateTime inputs to accept input from DateTime Widget and query data from DB

 

Velkumar_0-1684142113508.png

 

And whenever DateTime value is changed in Mashup, you can trigger this service to fetch new Data from DB 

 

/VR

View solution in original post

9 REPLIES 9

Hi @NH_shree 

 

From where you are getting 2 years data (DataTable, Stream or External DB)?

 

/VR

NH_shree
12-Amethyst
(To:Velkumar)

Hello @Velkumar , 

 

I am getting my data from the external database connected to thingworx , to access it I am using sql queries services in thingworx.

 

Regards,

Shree

NH_shree
12-Amethyst
(To:NH_shree)

Hello,

 

NH_shree_0-1684127250075.png

Here is the bar chart image that i am getting , we cannot make out anything from this and it is looking like a thin line instead of bar , please help if anyone has a solution with you.

 

Regards,

Shree

HI @NH_shree 

 

While querying data from DB, you can specify the dateTime range and get only the required data 

select * from TABLE_NAME where timeStampeValue > STARTDATE and timeStampeValue  < ENDDATE

 

In Thingworx SQL Query should look like this,

 

Velkumar_0-1684133244104.png

 

/ VR

NH_shree
12-Amethyst
(To:Velkumar)

Hi @Velkumar ,

 

Can't we use datetime widget and make the graph works based on the dates which we select ,

 

suppose for example if we are getting all data in the chart can we just select from 01/05/2023 to 7/05/2023 data to be displayed on the chart and meanwhile if we want to change the dates it should reflect in the viewmashup screen like we should give the input on the view mashup screen instead of mentioning start and end date in the sql query service , 

 

I am expecting the output like this, is it possible to do and how can we do  ?

 

Regards,

Shree

Hi @NH_shree 

 

You can create a service with dateTime inputs to accept input from DateTime Widget and query data from DB

 

Velkumar_0-1684142113508.png

 

And whenever DateTime value is changed in Mashup, you can trigger this service to fetch new Data from DB 

 

/VR

NH_shree
12-Amethyst
(To:Velkumar)

Hello @Velkumar ,

 

I have written a service as you have given in the above image and if I try to execute the service it is not giving me the exact values or data within the mentioned date , here I have the screenshot of the service executed

 

NH_shree_0-1684145723118.png

 

please guide me where i went wrong?

 

Regards,

Shree

 

@NH_shree  Could you show the code of chart1 service?

NH_shree
12-Amethyst
(To:Velkumar)

Hi @Velkumar ,

 

Thanks for the solution, I have solved it , I made a mistake in chart1 service that I did not added the input parameters hence I was getting all the rows in chart2 service , when i added the startdate and enddate input parameters the service got me the actual result

 

Thanks & Regards,

Shree

Top Tags