| 1 | package opts |
| 2 | |
| 3 | import "github.com/go-echarts/go-echarts/v2/types" |
| 4 | |
| 5 | // PieChart is the option set for a pie chart. |
| 6 | // https://echarts.apache.org/en/option.html#series-pie |
| 7 | type PieChart 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 | // Whether to show as Nightingale chart, which distinguishes data through radius. There are 2 optional modes: |
| 21 | // * 'radius' Use central angle to show the percentage of data, radius to show data size. |
| 22 | // * 'area' All the sectors will share the same central angle, the data size is shown only through radiuses. |
| 23 | RoseType string |
| 24 | |
| 25 | // Center position of Pie chart, the first of which is the horizontal position, and the second is the vertical position. |
| 26 | // Percentage is supported. When set in percentage, the item is relative to the container width, |
| 27 | // and the second item to the height. |
| 28 | // |
| 29 | // Example: |
| 30 | // |
| 31 | // Set to absolute pixel values ->> center: [400, 300] |
| 32 | // Set to relative percent ->> center: ['50%', '50%'] |
| 33 | Center interface{} |
| 34 | |
| 35 | // Radius of Pie chart. Value can be: |
| 36 | // * number: Specify outside radius directly. |
| 37 | // * string: For example, '20%', means that the outside radius is 20% of the viewport |
| 38 | // size (the little one between width and height of the chart container). |
| 39 | // |
| 40 | // Array.<number|string>: The first item specifies the inside radius, and the |
| 41 | // second item specifies the outside radius. Each item follows the definitions above. |
| 42 | Radius interface{} |
| 43 | |
| 44 | // PadAngle is the interval angle between pie sectors. |
| 45 | // Requires Apache ECharts 5.6.0 or newer. |
| 46 | // |
| 47 | // Example: |
| 48 | // |
| 49 | // Set to a number in degrees ->> padAngle: 5 |
| 50 | // No gap between sectors is the default behavior when this option is omitted. |
| 51 | PadAngle float64 |
| 52 | } |
| 53 | |
| 54 | // PieData |
| 55 | // https://echarts.apache.org/en/option.html#series-pie.data |
| 56 | type PieData struct { |
| 57 | // Name of data item. |
| 58 | Name string `json:"name,omitempty"` |
| 59 | |
| 60 | // Value of a single data item. |
| 61 | Value interface{} `json:"value,omitempty"` |
| 62 | |
| 63 | // Whether the data item is selected. |
| 64 | Selected types.Bool `json:"selected,omitempty"` |
| 65 | |
| 66 | // The label configuration of a single sector. |
| 67 | Label *Label `json:"label,omitempty"` |
| 68 | |
| 69 | // Graphic style of , emphasis is the style when it is highlighted, like being hovered by mouse, or highlighted via legend connect. |
| 70 | ItemStyle *ItemStyle `json:"itemStyle,omitempty"` |
| 71 | |
| 72 | // tooltip settings in this series data. |
| 73 | Tooltip *Tooltip `json:"tooltip,omitempty"` |
| 74 | } |