Export CSV data

hi,

today i found that the exported data from a csv export is not the same which provided by the datasource to the graph panel.
i know that the graph panel make “data tuning” for better visualisation, but my expectation for the CSV export was that the “raw” data will be exported.
Is there a way to achieve this?

kind regards
Bernd

What do you mean by “data tuning”? Grafana mostly just shows the data returned from the query (there are a few exceptions like aggregation options in the SingleStat panel).

sorry, you are right. at the visualisation everything works fine
The problem is actualy just exporting data as columns, here are the datapoint not correctly merged.
I attached a screenshot to clarify it with example data.
At the left side shows a correct export as rows, at the right side you see an incorrect export as columns:

What does that mean exactly? What is wrong with the data exported as columns?

i made a new image to clarify it
you can see at the image, that the values from the first time series “dampfmenge abhitze” are set to timestamps of the second timeseries “temperatur vor Endkühler”

Thanks for the explanation. There is a bug report in Grafana that matches this (as there are no other reports, seems like this feature is not used much or this is an unusual bug):

I took a very small sample of data with just a few data points and exported to columns and it was correct.

If you zoom in on your graph and then do an export is the result still incorrect?

after zooming the result is still incorrect

I paste my data below, maybe you can try it with it ? (upload is only for images available)

Series;Time;Value
Dampfmengen_Abhitze;2017-08-11T07:58:14.000Z;3,428000053
Dampfmengen_Abhitze;2017-08-11T07:59:21.000Z;3,829999924
Dampfmengen_Abhitze;2017-08-11T08:00:54.000Z;3,09214282
Dampfmengen_Abhitze;2017-08-11T08:02:04.000Z;2,360000014
Dampfmengen_Abhitze;2017-08-11T08:03:25.000Z;2,491799974
Dampfmengen_Abhitze;2017-08-11T08:04:34.000Z;3,238333305
Dampfmengen_Abhitze;2017-08-11T08:05:54.000Z;3,624000072
Dampfmengen_Abhitze;2017-08-11T08:07:14.000Z;2,857799959
Dampfmengen_Abhitze;2017-08-11T08:08:48.000Z;2,315000057
Dampfmengen_Abhitze;2017-08-11T08:10:34.000Z;2,89920001
Dampfmengen_Abhitze;2017-08-11T08:11:37.000Z;3,508999983
Dampfmengen_Abhitze;2017-08-11T08:13:14.000Z;3,694499969
Dampfmengen_Abhitze;2017-08-11T08:14:14.000Z;2,80250001
Dampfmengen_Abhitze;2017-08-11T08:15:54.000Z;2,362500072
Dampfmengen_Abhitze;2017-08-11T08:17:24.000Z;2,937749922
Dampfmengen_Abhitze;2017-08-11T08:18:42.000Z;3,626250029
Temperatur_vor_Endkühler;2017-08-11T07:58:15.350Z;107,234834
Temperatur_vor_Endkühler;2017-08-11T07:59:15.727Z;107,2369989
Temperatur_vor_Endkühler;2017-08-11T08:00:16.126Z;107,3015823
Temperatur_vor_Endkühler;2017-08-11T08:01:16.507Z;107,3984541
Temperatur_vor_Endkühler;2017-08-11T08:02:16.902Z;107,6118178
Temperatur_vor_Endkühler;2017-08-11T08:03:17.299Z;107,7841825
Temperatur_vor_Endkühler;2017-08-11T08:04:17.690Z;107,6680005
Temperatur_vor_Endkühler;2017-08-11T08:05:18.087Z;107,6384169
Temperatur_vor_Endkühler;2017-08-11T08:06:18.474Z;107,8606669
Temperatur_vor_Endkühler;2017-08-11T08:07:18.871Z;108,1498337
Temperatur_vor_Endkühler;2017-08-11T08:08:19.265Z;108,4806665
Temperatur_vor_Endkühler;2017-08-11T08:09:19.678Z;108,6970838
Temperatur_vor_Endkühler;2017-08-11T08:10:20.082Z;108,0962499
Temperatur_vor_Endkühler;2017-08-11T08:11:20.469Z;107,2770824
Temperatur_vor_Endkühler;2017-08-11T08:12:25.897Z;106,8882497
Temperatur_vor_Endkühler;2017-08-11T08:13:26.285Z;107,1929175
Temperatur_vor_Endkühler;2017-08-11T08:14:26.679Z;107,6766669
Temperatur_vor_Endkühler;2017-08-11T08:15:27.069Z;107,9150829
Temperatur_vor_Endkühler;2017-08-11T08:16:27.468Z;108,0140012
Temperatur_vor_Endkühler;2017-08-11T08:17:27.867Z;107,908584
Temperatur_vor_Endkühler;2017-08-11T08:18:28.243Z;107,8949165
Temperatur_vor_Endkühler;2017-08-11T08:19:28.631Z;108,1309967

@daniellee How I can add “Export CSV” to a custom panel?

1 Like

Hi Gustavo,

I haven’t tried this out in a plugin but think this should work.

You can add an action using the init-panel-actions event in the constructor:

this.events.on('init-panel-actions', this.onInitPanelActions.bind(this));

Then add the action:

  onInitPanelActions(actions) {
    actions.push({ text: 'Export CSV', click: 'ctrl.exportCsv()' });
  }

Then use the export csv directive in a modal like this:

  exportCsv() {
    const scope = this.$scope.$new(true);
    scope.tableData = this.renderer.render_values();
    scope.panel = 'table';
    this.publishAppEvent('show-modal', {
      templateHtml: '<export-data-modal panel="panel" data="tableData"></export-data-modal>',
      scope,
      modalClass: 'modal--narrow',
    });
  }

or like this if time series data:

  exportCsv() {
    const scope = this.$scope.$new(true);
    scope.seriesList = this.seriesList;
    this.publishAppEvent('show-modal', {
      templateHtml: '<export-data-modal data="seriesList"></export-data-modal>',
      scope,
      modalClass: 'modal--narrow',
    });
  }
1 Like

Big thanks @daniellee

We have seen similar problems with data export. We are testing grafana v5.4.2. together with influxdb v1.5.2.
We also tried doing statistical evaluations of measurement time series (10-20s over several weeks). It’s temperature and flow rates (as impulse counts). The flow rate values should be summed up, too.
Our topics:

  • Basically the trend curves are looking alright (total zoom and zooming in).
  • But the values of the y-axe is changing depending on the zooming in the chart
    With temperature values it’s obviously better.
  • baseline values of flow rate seem OK but not the maximum values.
  • then we tried total zoom for export data and further postprocessing.
    But not the raw data were exported.Obviously the current(!) wrong display data were exported
    This shouldn’t be.
  • cummulated curve: always chart data of current zoom window was summed up. Sorry, not useful.
    default value should be: cummulative sum of all values not depending on the chart zooming
    helpful enhancement: defining intervals of the curve that should be summed up. Is this possible?

Basically grafana is an interesting chart tool but getting reliable statistical results is necessary.
Thanks in advance.
Hermann

Hi, is this feature also available on Grafana cloud? How do I go about adding code?