Revision f2edd36359319ff8e50b7da816476a24896fd856 authored by brharrington on 01 May 2017, 22:19:52 UTC, committed by GitHub on 01 May 2017, 22:19:52 UTC
Fixes #564. We may move this behind a flag before 1.6 final,
but for now it is enabled by default. By including in the
v2.json format the UI/dashboard can use the static image
and switch to a dynamic rendering without making another
request.

The message has a type of `graph-image` with a data field
that is a data uri of the image without the legend.

Sample usage:

```html
<html>
<body>
<div id="content"></div>
<script>
var content = document.getElementById('content');

fetch('http://localhost:7101/api/v1/graph?q=name,sps,:eq,(,nf.cluster,),:by&format=v2.json')
  .then(function(response) {
    return response.json();
  })
  .then(function(json) {
    var html = '';
    json.forEach(function(msg) {
      if (msg.type === 'graph-image') {
        html += '<div><img src="' + msg.data + '"/></div>';
      } else if (msg.type === 'timeseries') {
        html += '<div>' + msg.label + '</div>';
      }
    });
    content.innerHTML = html;
  });
</script>
</body>
</html>
```
1 parent 16a734c
History

\r\n\r\n\r\n```"; var diffRevUrl = "/browse/revision/f2edd36359319ff8e50b7da816476a24896fd856/diff/"; swh.revision.initRevisionDiff(revMsgBody, diffRevUrl);

README.md

back to top