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 6import { LegendDisplayMode, OptionsWithLegend } from '@grafana/schema'; 7 8export const modelVersion = Object.freeze([1, 0]); 9 10export enum VizDisplayMode { 11 CandlesVolume = 'candles+volume', 12 Candles = 'candles', 13 Volume = 'volume', 14} 15 16export enum CandleStyle { 17 Candles = 'candles', 18 OHLCBars = 'ohlcbars', 19} 20 21export enum ColorStrategy { 22 // up/down color depends on current close vs current open 23 // filled always 24 OpenClose = 'open-close', 25 // up/down color depends on current close vs prior close 26 // filled/hollow depends on current close vs current open 27 CloseClose = 'close-close', 28} 29 30export interface CandlestickFieldMap { 31 open?: string; 32 high?: string; 33 low?: string; 34 close?: string; 35 volume?: string; 36} 37 38export interface CandlestickColors { 39 up: string; 40 down: string; 41 flat: string; 42} 43 44export const defaultColors: CandlestickColors = { 45 up: 'green', 46 down: 'red', 47 flat: 'gray', 48}; 49 50export interface CandlestickOptions extends OptionsWithLegend { 51 mode: VizDisplayMode; 52 candleStyle: CandleStyle; 53 colorStrategy: ColorStrategy; 54 fields: CandlestickFieldMap; 55 colors: CandlestickColors; 56 57 // When enabled, all fields will be sent to the graph 58 includeAllFields?: boolean; 59} 60 61export const defaultPanelOptions: CandlestickOptions = { 62 mode: VizDisplayMode.CandlesVolume, 63 candleStyle: CandleStyle.Candles, 64 colorStrategy: ColorStrategy.OpenClose, 65 colors: defaultColors, 66 fields: {}, 67 legend: { 68 displayMode: LegendDisplayMode.List, 69 placement: 'bottom', 70 calcs: [], 71 }, 72 includeAllFields: false, 73}; 74