| 1 | package opts |
| 2 | |
| 3 | import "github.com/go-echarts/go-echarts/v2/types" |
| 4 | |
| 5 | // BarChart |
| 6 | // https://echarts.apache.org/en/option.html#series-bar |
| 7 | type BarChart struct { |
| 8 | // ColorBy The policy to take color from option.color. Valid values: |
| 9 | // 'series': assigns the colors in the palette by series, so that all data in the same series are in the same color; |
| 10 | // 'data': assigns colors in the palette according to data items, with each data item using a different color. |
| 11 | ColorBy string |
| 12 | |
| 13 | // CoordinateSystem The coordinate used in the series, whose options are: |
| 14 | //'cartesian2d' Use a two-dimensional rectangular coordinate (also known as Cartesian coordinate), with xAxisIndex and |
| 15 | // yAxisIndex to assign the corresponding axis component. |
| 16 | // |
| 17 | // 'polar' Use polar coordinates, with polarIndex to assign the corresponding polar coordinate component. |
| 18 | CoordSystem string |
| 19 | |
| 20 | // Index of x axis to combine with, which is useful for multiple x axes in one chart. |
| 21 | XAxisIndex int |
| 22 | |
| 23 | // Index of y axis to combine with, which is useful for multiple y axes in one chart. |
| 24 | YAxisIndex int |
| 25 | |
| 26 | // Index of polar coordinate to combine with, which is useful for multiple polar axes in one chart. |
| 27 | PolarIndex int |
| 28 | |
| 29 | // Whether to add round caps at the end of the bar sectors. Valid only for bar series on polar coordinates. |
| 30 | RoundCap types.Bool |
| 31 | |
| 32 | // Whether to show background behind each bar. Use backgroundStyle to set background style. |
| 33 | ShowBackground types.Bool |
| 34 | |
| 35 | // Name of stack. On the same category axis, the series with the |
| 36 | // same stack name would be put on top of each other. |
| 37 | Stack string |
| 38 | |
| 39 | // The gap between bars between different series, is a percent value like '30%', |
| 40 | // which means 30% of the bar width. |
| 41 | // Set barGap as '-100%' can overlap bars that belong to different series, |
| 42 | // which is useful when putting a series of bar as background. |
| 43 | // In a single coordinate system, this attribute is shared by multiple 'bar' series. |
| 44 | // This attribute should be set on the last 'bar' series in the coordinate system, |
| 45 | // then it will be adopted by all 'bar' series in the coordinate system. |
| 46 | BarGap string |
| 47 | |
| 48 | // The bar gap of a single series, defaults to be 20% of the category gap, |
| 49 | // can be set as a fixed value. |
| 50 | // In a single coordinate system, this attribute is shared by multiple 'bar' series. |
| 51 | // This attribute should be set on the last 'bar' series in the coordinate system, |
| 52 | // then it will be adopted by all 'bar' series in the coordinate system. |
| 53 | BarCategoryGap string |
| 54 | |
| 55 | // The width of the bar. Adaptive when not specified. |
| 56 | // Can be an absolute value like 40 or a percent value like '60%'. The percent is based on the calculated category width. |
| 57 | // In a single coordinate system, this attribute is shared by multiple 'bar' series. |
| 58 | // This attribute should be set on the last 'bar' series in the coordinate system, then it will be adopted by all 'bar' series in the coordinate system. |
| 59 | BarWidth string |
| 60 | } |
| 61 | |
| 62 | // BarData |
| 63 | // https://echarts.apache.org/en/option.html#series-bar.data |
| 64 | type BarData struct { |
| 65 | // Name of data item. |
| 66 | Name string `json:"name,omitempty"` |
| 67 | |
| 68 | // Value of a single data item. |
| 69 | Value interface{} `json:"value,omitempty"` |
| 70 | |
| 71 | // The style setting of the text label in a single bar. |
| 72 | Label *Label `json:"label,omitempty"` |
| 73 | |
| 74 | // ItemStyle settings in this series data. |
| 75 | ItemStyle *ItemStyle `json:"itemStyle,omitempty"` |
| 76 | |
| 77 | // Tooltip settings in this series data. |
| 78 | Tooltip *Tooltip `json:"tooltip,omitempty"` |
| 79 | } |