Indirect Tag in Easy Chart in a Popup

For anyone struggling with this I offer this procedure to explain pturmel’s solution:

Problem definition
We want a template popup for trend charts. This requires passing several pieces of data to the popup:

  • A dataset containing the pens configuration.
  • A dataset containing the axis configuration.
  • (Optional / future) A dataset containing the subplot configuration.
  • A title for the popup.

Sample application
The main trick with this procedure is to configure a chart exactly as you want it to appear and then copy its dataset properties into the custom dataset properties of the button used to call the popup.

Structure

  • Main window
    • Button
      • Custom properties
        • tagPens
        • axisData
  • Popup
    • Root container
      • Custom properties
        • tagPens
        • axisData
        • Title
    • Easy Chart
      • Bind (uni-directionally) the Tag Pens to the popup’s root container’s tagPens property.
      • Bind (uni-directionally) the Axes to the popup’s root container’s axisData property.
    • Title label
      • Bind the text to the popup’s root container’s Title property.

Setup
For each button:

  • Open the popup in the Designer. Configure the chart exactly as you want it to appear for that popup.

  • You’re now going to copy the Tag Pens dataset that you have created in Easy Chart over to the tagPens dataset you created for the button on the main window.

    On the Easy Chart properties (1) select the Tag Pens dataset, (2) Select the row in the Dataset Editor and (3) copy to clipboard.

  • Now go back to the main window. You’re going to paste the dataset into the button’s custom properties.

    On the main window (1) select the button, (2) open the tagPens dataset editor and (3) paste in the dataset.

  • Repeat the procedure for the axisData dataset.

  • Finally you need to set the action for the button:

    Popup chart 3

    Right click on the button and select Scripting. (1) Select action | actionPerformed. (This catches both mouse and keyboard actions. (2) Open / swap. (3) Select the Popup window. (4) Pass Parameters, (5), (6) and (7) pass in the parameters. (8) Bind the parameters to the dataset custom property of the button itself. (That’s where you stored the configuration.)

Next button …

This may seem a little tedious but it is very powerful and using datasets allows you to handle charts with multiple pens, different aggregation modes, sub-plots (which will require an additional dataset to be passed) etc.

Thanks to Paul for posting enough information for me to figure this out.

3 Likes

Well done!