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

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

Cannot bind the result from a service to a time series chart

iherreros
5-Regular Member

Cannot bind the result from a service to a time series chart

Hi there!

I am getting data from another cloud through a service and I can bind the data to a grid but I cannot bind the same data to a time chart series. This is what I'm trying to do:

I have a list bind to a grid and whenever I select one option from the list, the respective data is displayed on the grid. I would like this very same data to be displayed on the chart as well, but I don't get anything. Besides, in the time chart properties I cannot select anything in the X and Y fields, it is blank.

I know how to do this with Kepware but I have no clue about how to do the same thing in this case.

Hope you can help me.

Thanks in advanced!

10 REPLIES 10
PaiChung
22-Sapphire I
(To:iherreros)

Do you have a datashape assigned to the output and if so, is the timestamp a basetype datetime?

iherreros
5-Regular Member
(To:PaiChung)

Hi Pai,

Yes, I have.

This is the data shape:

And this is what I get when a call the service in the mashup:

Any clue?

Thanks and best regards.

PaiChung
22-Sapphire I
(To:iherreros)

Looks like it is actually your Value field, change that to be a Number.

Time series chart can only plot Numbers over time, if you need a String, you can try it with a Label chart?

iherreros
5-Regular Member
(To:PaiChung)

Thanks Pai,

Now at least I can see the axis and the legend "value", but the date seems to be invalid.

I have formatted the data as this is how it really comes from the API

to:

But it is not working either, am I missing something?

PaiChung
22-Sapphire I
(To:iherreros)

you can try two approaches

1. cast it directly to the datetime field see if it takes

2. you'll need to use the Date() function to convert your data

iherreros
5-Regular Member
(To:PaiChung)

Hi Pai,

This is what I get when using Date() function:

This was my first approach:

Second approach:

Both produce the same result above.

Thanks.

PaiChung
22-Sapphire I
(To:iherreros)

The date looks good, how did you define the X axis in the chart properties?

Actually try the following, using the Date() function formatted service.

Remove your time series chart and put a new one in there, drop the data on it and then just view the mashup

iherreros
5-Regular Member
(To:PaiChung)

HI,

Not very sure about how to use that service... It is this service, isn't it?

I'm getting an error:

I have also used STRING but same error..

PaiChung
22-Sapphire I
(To:iherreros)

Just use Date() (java script function)

However that first result looks like a good result that I think Thingworx should be able to use.

iherreros
5-Regular Member
(To:PaiChung)

Hi Pai,

I have found finally the problem...a quite silly thing, in the datashape declaration the basetype of timestamp was STRING instead of DATETIME. I just copied and pasted the datashape declaration from other code... lazy girl!!

Now it is working

Many thanks for all your help!!

Best regards.

Top Tags