Submit
Path:
~
/
/
usr
/
share
/
grafana
/
public
/
app
/
plugins
/
panel
/
trend
/
File Content:
suggestions.ts
import { VisualizationSuggestionsBuilder } from '@grafana/data'; import { GraphDrawStyle, GraphFieldConfig, LegendDisplayMode } from '@grafana/schema'; import { SuggestionName } from 'app/types/suggestions'; import { Options } from './panelcfg.gen'; export class TrendSuggestionsSupplier { getSuggestionsForData(builder: VisualizationSuggestionsBuilder) { const { dataSummary } = builder; if (dataSummary.numberFieldCount < 2 || dataSummary.rowCountTotal < 2 || dataSummary.rowCountTotal < 2) { return; } // Super basic const list = builder.getListAppender<Options, GraphFieldConfig>({ name: SuggestionName.LineChart, pluginId: 'trend', options: { legend: { calcs: [], displayMode: LegendDisplayMode.Hidden, placement: 'right', showLegend: false, }, }, fieldConfig: { defaults: { custom: {}, }, overrides: [], }, cardOptions: { previewModifier: (s) => { if (s.fieldConfig?.defaults.custom?.drawStyle !== GraphDrawStyle.Bars) { s.fieldConfig!.defaults.custom!.lineWidth = Math.max(s.fieldConfig!.defaults.custom!.lineWidth ?? 1, 2); } }, }, }); return list; } }
Submit
FILE
FOLDER
INFO
Name
Size
Permission
Action
img
---
0755
TrendPanel.tsx
5762 bytes
0644
module.tsx
1155 bytes
0644
panelcfg.cue
1142 bytes
0644
panelcfg.gen.ts
611 bytes
0644
plugin.json
326 bytes
0644
suggestions.ts
1289 bytes
0644
N4ST4R_ID | Naxtarrr