models.gen.ts 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import {
  2. OptionsWithLegend,
  3. OptionsWithTextFormatting,
  4. OptionsWithTooltip,
  5. AxisConfig,
  6. VisibilityMode,
  7. GraphGradientMode,
  8. HideableFieldConfig,
  9. StackingMode,
  10. } from '@grafana/schema';
  11. import { VizOrientation } from '@grafana/data';
  12. export interface PanelOptions extends OptionsWithLegend, OptionsWithTooltip, OptionsWithTextFormatting {
  13. xField?: string;
  14. colorByField?: string;
  15. orientation: VizOrientation;
  16. stacking: StackingMode;
  17. showValue: VisibilityMode;
  18. barWidth: number;
  19. barRadius?: number;
  20. groupWidth: number;
  21. xTickLabelRotation: number;
  22. xTickLabelMaxLength: number;
  23. xTickLabelSpacing?: number; // negative values indicate backwards skipping behavior
  24. }
  25. export const defaultPanelOptions: Partial<PanelOptions> = {
  26. stacking: StackingMode.None,
  27. orientation: VizOrientation.Auto,
  28. xTickLabelRotation: 0,
  29. xTickLabelSpacing: 0,
  30. showValue: VisibilityMode.Auto,
  31. groupWidth: 0.7,
  32. barWidth: 0.97,
  33. barRadius: 0,
  34. };
  35. export interface BarChartFieldConfig extends AxisConfig, HideableFieldConfig {
  36. lineWidth?: number; // 0
  37. fillOpacity?: number; // 100
  38. gradientMode?: GraphGradientMode;
  39. }
  40. export const defaultBarChartFieldConfig: BarChartFieldConfig = {
  41. lineWidth: 1,
  42. fillOpacity: 80,
  43. gradientMode: GraphGradientMode.None,
  44. };