X axis on XY chart linked to a Tag

Hello,

I am using Perspective to create a chart. I needed someone to explain how to change the X axis to the values of a tag. What properties do I change and what type of binding would I use?

The XY Chart needs to be supplied with a datasource. Drop an XY Chart into a view and you will see the sample data in the Perspective Property Editor under PROPS.dataSources.example.

Study that and how the axes are using the data.

If you have further questions then post a set of data here and format it as code. Your dataset will need to have at least two columns - one for the X-axis and one for the Y-axis.

Hello,

Is a dataset necessary? Right now, I have 2 tags. I would like to use the value of tag 1 for the x axis and the value of tag 2 for the y axis??

Do you mean, "I want to plot a single point on an XY Chart. Tag1 will provide the X-coordinate and Tag2 will provide the Y-coordinate."?

If so, yes, you will still need a datasource (which is not the same thing as a dataset).

  • Create a new dataSource array. I've called mine pointData.
  • In that, add an object. It should show up as 0.
  • In 0 add values x and y.
  • Create a tag binding on x to Tag1.
  • Create a tag binding on y to Tag2.

You'll then have to sort out the series properties to use these values.

If you get stuck then post the chart JSON here. See Wiki - how to post code on this forum.

No, sorry for the confusion. I was hoping that with the tag history I would be able to create a line graph. Using the tag history of tag 1 and tag 2.

This is the first mention of "tag history" in the thread. You need to define your requirements much more clearly.

Are you now saying, "I want to plot on an XY Chart a line showing the history of Tag2 (y-value) as a function of Tag1 (x-value)."?

If so, then,

  • Create a new datasource, pointData.
  • Create a Tag History binding on the array.
    • Return Format : Wide.
    • Set Query Mode as required.
    • Set Time Range : Historical.
    • Enter the Start Date and End Date manually for now.
    • In Select Tags add the two tags using the tag picker. Set the alias of Tag1 to x and Tag2 to y.

This will return a dataset with three columns, t_stamp (which you won't use), x and y.