VMware Modern Apps Community
bradleyka93
Enthusiast
Enthusiast
Jump to solution

Embedding chart with a variable

I'm embedding a chart that contains a variable, how can I dynamically pass this variable into the embed chart script? There are 8 charts I want to embed, but around 40 variables. Without being able to pass the variable in I would need to create 8x40 chart embed scripts.

I'm hoping this can be done as part of the script source, i.e. https://metrics.wavefront.com/embedded/embedId/js?myVar=something

Thanks,
Marcus

vasily@wavefront.com
Correct Answer by vasily@wavefront.com on Jun 27, 2017 8:02 PM

Hi Marcus,

Currently this mechanism is not implemented due to security concerns - we have a feature request open to implement parametrized charts in a way that does not create security risks, but there are no ETAs yet. I've made a note that you are interested in this feature as well. If you need to create several hundred embedded charts, it might be easier to create these programmatically using an undocumented method of our API. The URL for creating embedded charts is https://metrics.wavefront.com/embedded/create. It expects an HTTP POST request with a JSON object as a payload. The object contains the chart query itself, and start time and end time in epoch seconds), like in this basic example:

{ 
     "chart": {
          "name": "Embedded chart name",
          "summarization": "MEAN",
          "chartSettings": { "type": "line" },
          "units": "units",
          "sources": [ { "name": "New Query", "query": "<YOUR QUERY>" } ]
     },
     "startTime": 1455222572,
     "endTime": 1455229772,
     "live": false
}

Please let us know if this helps!

-Vasily

0 Kudos
1 Solution

Accepted Solutions
bradleyka93
Enthusiast
Enthusiast
Jump to solution

Hi Marcus,

Currently this mechanism is not implemented due to security concerns - we have a feature request open to implement parametrized charts in a way that does not create security risks, but there are no ETAs yet. I've made a note that you are interested in this feature as well. If you need to create several hundred embedded charts, it might be easier to create these programmatically using an undocumented method of our API. The URL for creating embedded charts is https://metrics.wavefront.com/embedded/create. It expects an HTTP POST request with a JSON object as a payload. The object contains the chart query itself, and start time and end time in epoch seconds), like in this basic example:

{ 
     "chart": {
          "name": "Embedded chart name",
          "summarization": "MEAN",
          "chartSettings": { "type": "line" },
          "units": "units",
          "sources": [ { "name": "New Query", "query": "<YOUR QUERY>" } ]
     },
     "startTime": 1455222572,
     "endTime": 1455229772,
     "live": false
}

Please let us know if this helps!

-Vasily

View solution in original post

0 Kudos
1 Reply
bradleyka93
Enthusiast
Enthusiast
Jump to solution

Hi Marcus,

Currently this mechanism is not implemented due to security concerns - we have a feature request open to implement parametrized charts in a way that does not create security risks, but there are no ETAs yet. I've made a note that you are interested in this feature as well. If you need to create several hundred embedded charts, it might be easier to create these programmatically using an undocumented method of our API. The URL for creating embedded charts is https://metrics.wavefront.com/embedded/create. It expects an HTTP POST request with a JSON object as a payload. The object contains the chart query itself, and start time and end time in epoch seconds), like in this basic example:

{ 
     "chart": {
          "name": "Embedded chart name",
          "summarization": "MEAN",
          "chartSettings": { "type": "line" },
          "units": "units",
          "sources": [ { "name": "New Query", "query": "<YOUR QUERY>" } ]
     },
     "startTime": 1455222572,
     "endTime": 1455229772,
     "live": false
}

Please let us know if this helps!

-Vasily

0 Kudos