Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X
Hi,
I'm currently using a label chart (line/marker) to display some data.
I want to have multiple sets of data displayed on the chart, and I know that I can use multiple datasources inherent to the chart to do that. However, the problem is, that the number of these sets of data is dynamic.
For example, let's say I want to display data for fastfood places where the y axis and the x axis for these sets of data are the same. However, when the user adds another fastfood place to the database, I want that to show up on my label chart without me having to manually bringing in the new set of data for the new fastfood place that was added and binding it to one of the datasources of the label chart. How do I accomplish this?
Thank you!
Hi,
The data bindings configured in Chart widget are all manual operations, so I can only provide you with a workaround solution: add extra blank datasource to the chart.
If you have predefined blank datasource, the line/ markers in Chart will show these records at the bottom of the chart with null or 0 value, this may not be perfect but hopefully acceptable for regular users. And when you need to add real data into the chart, you can use services like AddorUpdateStreamdata to make this datasource meaningful. This is for your reference.
You can bind the service output as infotable with multiple dynamic columns to the Data field on the Timeseries/LabelChart, the Infotable structure should be something like:
Column1: timestamp
Column2(optional): myDataField1
Column3(optional): myDataField2
....
On the service you add the necessary columns with AddField to the infotable, you start with a simple DataShape of only one column "timestamp"
Then the widget will do the rest showing as many series as columns you have (with a maximum of 16, you can set the maximum on "NumberOfSeries")
Thank you for your response, Carles.
Just making sure that I understood you correctly,
I would write a service that spits out an infotable, which will be bound to a single Data Source on the Label Chart.
The service starts with an infotable with the column that would have my x values (in my case, it's not time), and the additional columns will be the y values for the series of data. (Or are these additional columns also infotables that have two columns: x and y values).
After I bind it, I dont need to configure things manually like setting the pen colors, setting data fields and stuff, which are what I would do if i were to bind multiple series of data manually?
I tested this out, but I still need to manually assign the columns of the infotable to the datafields in the property box for the label chart. (XAxisField, DataField1, DataField2, etc). Is there a way to do this without manualling assigning the columns?
I tested this out, but I still need to manually assign the columns of the infotable to the datafields in the property box for the label chart. (XAxisField, DataField1, DataField2, etc). Is there a way to do this without manualling assigning the columns?