models.gen.ts 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2. // NOTE: This file will be auto generated from models.cue
  3. // It is currenty hand written but will serve as the target for cuetsy
  4. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  5. import { AxisConfig, AxisPlacement, HideableFieldConfig, ScaleDistributionConfig, VisibilityMode } from '@grafana/schema';
  6. import { HeatmapCellLayout, HeatmapCalculationOptions } from 'app/features/transformers/calculateHeatmap/models.gen';
  7. export const modelVersion = Object.freeze([1, 0]);
  8. export enum HeatmapColorMode {
  9. Opacity = 'opacity',
  10. Scheme = 'scheme',
  11. }
  12. export enum HeatmapColorScale {
  13. Linear = 'linear',
  14. Exponential = 'exponential',
  15. }
  16. export interface HeatmapColorOptions {
  17. mode: HeatmapColorMode;
  18. scheme: string; // when in scheme mode -- the d3 scheme name
  19. fill: string; // when opacity mode, the target color
  20. scale: HeatmapColorScale; // for opacity mode
  21. exponent: number; // when scale== sqrt
  22. steps: number; // 2-128
  23. // Clamp the colors to the value range
  24. min?: number;
  25. max?: number;
  26. }
  27. export interface YAxisConfig extends AxisConfig {
  28. unit?: string;
  29. reverse?: boolean;
  30. decimals?: number;
  31. // Only used when the axis is not ordinal
  32. min?: number;
  33. max?: number;
  34. }
  35. export interface CellValues {
  36. unit?: string;
  37. decimals?: number;
  38. }
  39. export interface FilterValueRange {
  40. le?: number;
  41. ge?: number;
  42. }
  43. export interface HeatmapTooltip {
  44. show: boolean;
  45. yHistogram?: boolean;
  46. }
  47. export interface HeatmapLegend {
  48. show: boolean;
  49. }
  50. export interface ExemplarConfig {
  51. color: string;
  52. }
  53. export interface RowsHeatmapOptions {
  54. value?: string; // value field name
  55. layout?: HeatmapCellLayout;
  56. }
  57. export interface PanelOptions {
  58. calculate?: boolean;
  59. calculation?: HeatmapCalculationOptions;
  60. color: HeatmapColorOptions;
  61. filterValues?: FilterValueRange; // was hideZeroBuckets
  62. rowsFrame?: RowsHeatmapOptions;
  63. showValue: VisibilityMode;
  64. cellGap?: number; // was cardPadding
  65. cellRadius?: number; // was cardRadius (not used, but migrated from angular)
  66. cellValues?: CellValues;
  67. yAxis: YAxisConfig;
  68. legend: HeatmapLegend;
  69. tooltip: HeatmapTooltip;
  70. exemplars: ExemplarConfig;
  71. }
  72. export const defaultPanelOptions: PanelOptions = {
  73. calculate: false,
  74. color: {
  75. mode: HeatmapColorMode.Scheme,
  76. scheme: 'Oranges',
  77. fill: 'dark-orange',
  78. scale: HeatmapColorScale.Exponential,
  79. exponent: 0.5,
  80. steps: 64,
  81. },
  82. rowsFrame: {
  83. layout: HeatmapCellLayout.auto,
  84. },
  85. yAxis: {
  86. axisPlacement: AxisPlacement.Left,
  87. },
  88. cellValues: {
  89. },
  90. showValue: VisibilityMode.Auto,
  91. tooltip: {
  92. show: true,
  93. yHistogram: false,
  94. },
  95. legend: {
  96. show: true,
  97. },
  98. exemplars: {
  99. color: 'rgba(255,0,255,0.7)',
  100. },
  101. filterValues: {
  102. le: 1e-9,
  103. },
  104. cellGap: 1,
  105. };
  106. export interface PanelFieldConfig extends HideableFieldConfig {
  107. scaleDistribution?: ScaleDistributionConfig;
  108. }
  109. export const defaultPanelFieldConfig: PanelFieldConfig = {};