| 1 | package opts |
| 2 | |
| 3 | import "github.com/go-echarts/go-echarts/v2/types" |
| 4 | |
| 5 | // VisualMap is a type of component for visual encoding, which maps the data to visual channels. |
| 6 | // https://echarts.apache.org/en/option.html#visualMap |
| 7 | type VisualMap struct { |
| 8 | // Mapping type. |
| 9 | // Options: "continuous", "piecewise" |
| 10 | Type string `json:"type,omitempty" default:"continuous"` |
| 11 | |
| 12 | // Whether show handles, which can be dragged to adjust "selected range". |
| 13 | Calculable types.Bool `json:"calculable"` |
| 14 | |
| 15 | // Specify the min dataValue for the visualMap component. |
| 16 | // [visualMap.min, visualMax.max] make up the domain of visual mapping. |
| 17 | Min float32 `json:"min,omitempty"` |
| 18 | |
| 19 | // Specify the max dataValue for the visualMap component. |
| 20 | // [visualMap.min, visualMax.max] make up the domain of visual mapping. |
| 21 | Max float32 `json:"max,omitempty"` |
| 22 | |
| 23 | // Specify selected range, that is, the dataValue corresponding to the two handles. |
| 24 | Range []float32 `json:"range,omitempty"` |
| 25 | |
| 26 | // The label text on both ends, such as ['High', 'Low']. |
| 27 | Text []string `json:"text,omitempty"` |
| 28 | |
| 29 | // Specify which dimension should be used to fetch dataValue from series.data, and then map them to visual channel. |
| 30 | Dimension string `json:"dimension,omitempty"` |
| 31 | |
| 32 | // Define visual channels that will mapped from dataValues that are in selected range. |
| 33 | InRange *VisualMapInRange `json:"inRange,omitempty"` |
| 34 | |
| 35 | // Used to customize how to slice continuous data, and some specific view style for some pieces. |
| 36 | Pieces []Piece `json:"pieces,omitempty"` |
| 37 | |
| 38 | // Whether to show visualMap-piecewise component. If set as false, |
| 39 | // visualMap-piecewise component will not show, |
| 40 | // but it can still perform visual mapping from dataValue to visual channel in chart. |
| 41 | Show types.Bool `json:"show,omitempty"` |
| 42 | |
| 43 | // Distance between visualMap component and the left side of the container. |
| 44 | // left value can be instant pixel value like 20; it can also be a percentage |
| 45 | // value relative to container width like '20%'; and it can also be 'left', 'center', or 'right'. |
| 46 | // If the left value is set to be 'left', 'center', or 'right', |
| 47 | // then the component will be aligned automatically based on position. |
| 48 | Left string `json:"left,omitempty"` |
| 49 | |
| 50 | // Distance between visualMap component and the right side of the container. |
| 51 | // right value can be instant pixel value like 20; it can also be a percentage |
| 52 | // value relative to container width like '20%'. |
| 53 | Right string `json:"right,omitempty"` |
| 54 | |
| 55 | // Distance between visualMap component and the top side of the container. |
| 56 | // top value can be instant pixel value like 20; it can also be a percentage |
| 57 | // value relative to container width like '20%'; and it can also be 'top', 'middle', or 'bottom'. |
| 58 | // If the left value is set to be 'top', 'middle', or 'bottom', |
| 59 | // then the component will be aligned automatically based on position. |
| 60 | Top string `json:"top,omitempty"` |
| 61 | |
| 62 | // Distance between visualMap component and the bottom side of the container. |
| 63 | // bottom value can be instant pixel value like 20; it can also be a percentage |
| 64 | // value relative to container width like '20%'. |
| 65 | Bottom string `json:"bottom,omitempty"` |
| 66 | |
| 67 | // The layout orientation of legend. |
| 68 | // Options: 'horizontal', 'vertical' |
| 69 | Orient string `json:"orient,omitempty"` |
| 70 | |
| 71 | // Text style |
| 72 | TextStyle *TextStyle `json:"textStyle,omitempty"` |
| 73 | } |
| 74 | |
| 75 | // VisualMapInRange is a visual map instance in a range. |
| 76 | type VisualMapInRange struct { |
| 77 | // Color |
| 78 | Color []string `json:"color,omitempty"` |
| 79 | |
| 80 | // Symbol type at the two ends of the mark line. It can be an array for two ends, or assigned separately. |
| 81 | // Options: "circle", "rect", "roundRect", "triangle", "diamond", "pin", "arrow", "none" |
| 82 | Symbol string `json:"symbol,omitempty"` |
| 83 | |
| 84 | // Symbol size. |
| 85 | SymbolSize float32 `json:"symbolSize,omitempty"` |
| 86 | } |
| 87 | |
| 88 | // Piece Used to customize how to slice continuous data, and some specific view style for some pieces. |
| 89 | type Piece struct { |
| 90 | Min float32 `json:"min,omitempty"` |
| 91 | |
| 92 | Max float32 `json:"max,omitempty"` |
| 93 | |
| 94 | Lt float32 `json:"lt,omitempty"` |
| 95 | |
| 96 | Lte float32 `json:"lte,omitempty"` |
| 97 | |
| 98 | Gt float32 `json:"gt,omitempty"` |
| 99 | |
| 100 | Gte float32 `json:"gte,omitempty"` |
| 101 | |
| 102 | // Symbol color |
| 103 | Color string `json:"color,omitempty"` |
| 104 | } |