mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Graph: added export graph time series data as csv file feature, accessed from panel menu dropdown, #861
This commit is contained in:
parent
c11ce99bb3
commit
640c558446
@ -8,6 +8,7 @@
|
|||||||
- [Issue #850](https://github.com/grafana/grafana/issues/850). Graph: Shared tooltip that shows multiple series & crosshair line, thx @toni-moreno
|
- [Issue #850](https://github.com/grafana/grafana/issues/850). Graph: Shared tooltip that shows multiple series & crosshair line, thx @toni-moreno
|
||||||
- [Issue #940](https://github.com/grafana/grafana/issues/940). Graph: New series style override option "Fill below to", useful to visualize max & min as a shadow for the mean
|
- [Issue #940](https://github.com/grafana/grafana/issues/940). Graph: New series style override option "Fill below to", useful to visualize max & min as a shadow for the mean
|
||||||
- [Issue #1030](https://github.com/grafana/grafana/issues/1030). Graph: Legend table display/look changed, now includes column headers for min/max/avg, and full width (unless on right side)
|
- [Issue #1030](https://github.com/grafana/grafana/issues/1030). Graph: Legend table display/look changed, now includes column headers for min/max/avg, and full width (unless on right side)
|
||||||
|
- [Issue #861](https://github.com/grafana/grafana/issues/861). Graph: Export graph time series data as csv file
|
||||||
|
|
||||||
**New Panels**
|
**New Panels**
|
||||||
- [Issue #951](https://github.com/grafana/grafana/issues/951). SingleStat: New singlestat panel
|
- [Issue #951](https://github.com/grafana/grafana/issues/951). SingleStat: New singlestat panel
|
||||||
|
@ -459,6 +459,17 @@ function($, _, moment) {
|
|||||||
.replace(/ +/g,'-');
|
.replace(/ +/g,'-');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
kbn.exportSeriesListToCsv = function(seriesList) {
|
||||||
|
var text = 'Series;Time;Value\n';
|
||||||
|
_.each(seriesList, function(series) {
|
||||||
|
_.each(series.datapoints, function(dp) {
|
||||||
|
text += series.alias + ';' + new Date(dp[1]).toISOString() + ';' + dp[0] + '\n';
|
||||||
|
});
|
||||||
|
});
|
||||||
|
var blob = new Blob([text], { type: "text/csv;charset=utf-8" });
|
||||||
|
window.saveAs(blob, 'grafana_data_export.csv');
|
||||||
|
};
|
||||||
|
|
||||||
kbn.stringToJsRegex = function(str) {
|
kbn.stringToJsRegex = function(str) {
|
||||||
if (str[0] !== '/') {
|
if (str[0] !== '/') {
|
||||||
return new RegExp(str);
|
return new RegExp(str);
|
||||||
|
@ -30,6 +30,7 @@ function (angular, app, $, _, kbn, moment, TimeSeries, PanelMeta) {
|
|||||||
$scope.panelMeta.addEditorTab('Axes & Grid', 'app/panels/graph/axisEditor.html');
|
$scope.panelMeta.addEditorTab('Axes & Grid', 'app/panels/graph/axisEditor.html');
|
||||||
$scope.panelMeta.addEditorTab('Display Styles', 'app/panels/graph/styleEditor.html');
|
$scope.panelMeta.addEditorTab('Display Styles', 'app/panels/graph/styleEditor.html');
|
||||||
|
|
||||||
|
$scope.panelMeta.addExtendedMenuItem('Export CSV', '', 'exportCsv()');
|
||||||
$scope.panelMeta.addExtendedMenuItem('Toggle legend', '', 'toggleLegend()');
|
$scope.panelMeta.addExtendedMenuItem('Toggle legend', '', 'toggleLegend()');
|
||||||
|
|
||||||
// Set and populate defaults
|
// Set and populate defaults
|
||||||
@ -283,6 +284,10 @@ function (angular, app, $, _, kbn, moment, TimeSeries, PanelMeta) {
|
|||||||
$scope.get_data();
|
$scope.get_data();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.exportCsv = function() {
|
||||||
|
kbn.exportSeriesListToCsv($scope.seriesList);
|
||||||
|
};
|
||||||
|
|
||||||
panelSrv.init($scope);
|
panelSrv.init($scope);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user