It is currently Sat Aug 30, 2014 2:28 am




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 17 posts ]  Go to page 1, 2  Next
 Help with Chart Component 
Author Message
Captain
Captain

Joined: Sun Mar 27, 2011 5:34 pm
Posts: 91
Post Help with Chart Component
Hi Guys,

I have been given a MSQL Database Table that has been populated with 3 columns.
Column 1 has a Date, this has been set as a MSQL "Date" datatype.
Column 2 has a Time, this has been set as a MSQL "Time" datatype
Column 3 has intergers

I have tried to display the Data (Col 1 and col 3 only) in a Chart component but the Date as the X plot errors as an unknown value for X plot.

I tried to cast the "Date" to a datetime in the Data query which stops the error but fails to draw anything. The Dataset date column shows as 01/04/2012 00:00:00

If I remove the binding and manually manipulate the dataset Date to have an actual time eg. 01/04/2012 01:00:00 the chart works.

So getting to the question....

Is there a way to combine columns 1 and 2 to make a proper Datetime for the chart in a query or can I format just the Date (col 1) in a way that the chart likes?

Cheers for any help.

Tim...


Thu Apr 19, 2012 5:08 pm
Profile
Captain
Captain

Joined: Thu May 12, 2011 1:00 pm
Posts: 76
Location: Northern California
Post Re: Help with Chart Component
When you cast the date column are you using the built in function system.db.dateFormat(date_cell,"yyyy-MM-dd HH:mm:ss") ? Or are you casting with your SQL call?
I haven't had any problems using dates that have "no actual time" like your '01/04/2012 00:00:00'.


Mon Apr 23, 2012 10:54 am
Profile
Captain
Captain

Joined: Thu May 12, 2011 1:00 pm
Posts: 76
Location: Northern California
Post Re: Help with Chart Component
Just saw that you did the casting it in your date query. Can you iterate through the list and do it in a script instead with the function I mentioned above?


Mon Apr 23, 2012 10:57 am
Profile
Moderator
Moderator

Joined: Sun Apr 02, 2006 2:46 pm
Posts: 1982
Location: Sacramento, CA
Post Re: Help with Chart Component
Can you post the SQL query that you are using?

_________________
Travis Cox
Inductive Automation
Technical Support Rep.


Mon Apr 23, 2012 3:41 pm
Profile WWW
Captain
Captain

Joined: Sun Mar 27, 2011 5:34 pm
Posts: 91
Post Re: Help with Chart Component
[Log Date] is a "Date" datatype in MSQL
Using this query the Chart errors with" Illegal type for X value"
SELECT [Log Date] as t_stamp, [TR#1 Today permeate (kL)] FROM datalogA

This Query has no errors, but fails to display
SELECT cast([Log Date] as datetime) as t_stamp, [TR#1 Today permeate (kL)] FROM datalogA


Mon Apr 23, 2012 3:52 pm
Profile
Moderator
Moderator

Joined: Sun Apr 02, 2006 2:46 pm
Posts: 1982
Location: Sacramento, CA
Post Re: Help with Chart Component
I have a feeling it is not returning an actual date object. Click on the dataset view icon (next to the binding icon) on the Data property of the component. Once opened, click on the date column and tell me what the data type? You will see it below the table.

_________________
Travis Cox
Inductive Automation
Technical Support Rep.


Mon Apr 23, 2012 3:57 pm
Profile WWW
Captain
Captain

Joined: Sun Mar 27, 2011 5:34 pm
Posts: 91
Post Re: Help with Chart Component
ahhhhh...

You are correct, its still showing as a Date type??


Mon Apr 23, 2012 4:00 pm
Profile
Moderator
Moderator

Joined: Sun Apr 02, 2006 2:46 pm
Posts: 1982
Location: Sacramento, CA
Post Re: Help with Chart Component
Date is correct. It should be working ok. Let's check a couple of things:

1) What is the value of the Chart Type property on the graph?
2) If you open the chart customizer (through right click) and select the Dataset Properties tab what is the Renderer for your dataset?

_________________
Travis Cox
Inductive Automation
Technical Support Rep.


Mon Apr 23, 2012 4:08 pm
Profile WWW
Captain
Captain

Joined: Sun Mar 27, 2011 5:34 pm
Posts: 91
Post Re: Help with Chart Component
1/ Default. XY Plot
2/ Default. XY Line/Shape renderer


Mon Apr 23, 2012 4:51 pm
Profile
Moderator
Moderator

Joined: Sun Apr 02, 2006 2:46 pm
Posts: 1982
Location: Sacramento, CA
Post Re: Help with Chart Component
Can you export a copy of the window with the error on it so we can see what is going on?

_________________
Travis Cox
Inductive Automation
Technical Support Rep.


Tue Apr 24, 2012 6:42 am
Profile WWW
Captain
Captain

Joined: Sun Mar 27, 2011 5:34 pm
Posts: 91
Post Re: Help with Chart Component
Doc attached with the chart setup.

No errors just a blank chart.

The error I was finding with just using the [Log Date] without casting it as a datetime was that the Dataset column was being shown as a string even though the SQL column is a Date type.


Attachments:
Doc1.doc [122.5 KiB]
Downloaded 38 times
Tue Apr 24, 2012 6:24 pm
Profile
Moderator
Moderator

Joined: Sun Apr 02, 2006 2:46 pm
Posts: 1982
Location: Sacramento, CA
Post Re: Help with Chart Component
It appears you have it setup correctly but for some reason the data is not showing up. Can you post a couple more screenshots from the chart customizer? One of the X-Axes tab with the axis selected and one of the of the Dataset Properties tab with the Data selected.

_________________
Travis Cox
Inductive Automation
Technical Support Rep.


Wed Apr 25, 2012 7:30 am
Profile WWW
Captain
Captain

Joined: Sun Mar 27, 2011 5:34 pm
Posts: 91
Post Re: Help with Chart Component
Screenshots attached

Cheers


Attachments:
Doc2.doc [99.5 KiB]
Downloaded 44 times
Wed Apr 25, 2012 1:33 pm
Profile
Moderator
Moderator

Joined: Sun Apr 02, 2006 2:46 pm
Posts: 1982
Location: Sacramento, CA
Post Re: Help with Chart Component
Ok, I don't know why the data is not showing up. Everything looks like it is configured correctly. Any chance you can call our tech support or export that window in the designer and send it to us (not screenshots but the actual window)?

_________________
Travis Cox
Inductive Automation
Technical Support Rep.


Wed Apr 25, 2012 3:38 pm
Profile WWW
Captain
Captain

Joined: Sun Mar 27, 2011 5:34 pm
Posts: 91
Post Re: Help with Chart Component
Window Export attached

Cheers


Attachments:
Overview_2012-04-26_0912_partial.proj [46.55 KiB]
Downloaded 38 times
Wed Apr 25, 2012 3:44 pm
Profile
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 17 posts ]  Go to page 1, 2  Next


Who is online

Users browsing this forum: Yahoo [Bot] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: