| 1 | package opts |
| 2 | |
| 3 | import ( |
| 4 | "fmt" |
| 5 | |
| 6 | "github.com/go-echarts/go-echarts/v2/types" |
| 7 | ) |
| 8 | |
| 9 | // Label contains options for a label text, it is a generic label config for all label needs. |
| 10 | // i.e. https://echarts.apache.org/en/option.html#series-line.label |
| 11 | type Label struct { |
| 12 | // Whether to show label. |
| 13 | Show types.Bool `json:"show,omitempty"` |
| 14 | |
| 15 | // Color is the text color. |
| 16 | // If set as "auto", the color will assigned as visual color, such as series color. |
| 17 | Color string `json:"color,omitempty"` |
| 18 | |
| 19 | // font style. |
| 20 | // Options are: 'normal', 'italic', 'oblique' |
| 21 | FontStyle string `json:"fontStyle,omitempty"` |
| 22 | |
| 23 | // font thick weight. |
| 24 | // Options are: 'normal', 'bold', 'bolder', 'lighter', 100 | 200 | 300 | 400... |
| 25 | FontWeight string `json:"fontWeight,omitempty"` |
| 26 | |
| 27 | // font family. |
| 28 | // Can also be 'serif' , 'monospace', ... |
| 29 | FontFamily string `json:"fontFamily,omitempty"` |
| 30 | |
| 31 | // font size. |
| 32 | FontSize float32 `json:"fontSize,omitempty"` |
| 33 | |
| 34 | // Horizontal alignment of text, automatic by default. |
| 35 | // Options are: 'left', 'center', 'right' |
| 36 | Align string `json:"align,omitempty"` |
| 37 | |
| 38 | // Vertical alignment of text, automatic by default. |
| 39 | // Options are: 'top', 'middle', 'bottom' |
| 40 | VerticalAlign string `json:"verticalAlign,omitempty"` |
| 41 | |
| 42 | // Line height of the text fragment. |
| 43 | LineHeight float32 `json:"lineHeight,omitempty"` |
| 44 | |
| 45 | // Background color of the text fragment. |
| 46 | BackgroundColor string `json:"backgroundColor,omitempty"` |
| 47 | |
| 48 | // Border color of the text fragment. |
| 49 | BorderColor string `json:"borderColor,omitempty"` |
| 50 | |
| 51 | // Border width of the text fragment. |
| 52 | BorderWidth float32 `json:"borderWidth,omitempty"` |
| 53 | |
| 54 | // the text fragment border type. |
| 55 | // Possible values are: 'solid', 'dashed', 'dotted' |
| 56 | BorderType string `json:"borderType,omitempty"` |
| 57 | |
| 58 | // To set the line dash offset. With borderType , we can make the line style more flexible. |
| 59 | BorderDashOffset float32 `json:"borderDashOffset,omitempty"` |
| 60 | |
| 61 | // Border radius of the text fragment. |
| 62 | BorderRadius float32 `json:"borderRadius,omitempty"` |
| 63 | |
| 64 | // Padding of the text fragment, for example: |
| 65 | // padding: [3, 4, 5, 6]: represents padding of [top, right, bottom, left]. |
| 66 | // padding: 4: represents padding: [4, 4, 4, 4]. |
| 67 | // padding: [3, 4]: represents padding: [3, 4, 3, 4]. |
| 68 | // Notice, width and height specifies the width and height of the content, without padding. |
| 69 | Padding string `json:"padding,omitempty"` |
| 70 | |
| 71 | // Label position. Followings are the options: |
| 72 | // |
| 73 | // [x, y] |
| 74 | // Use relative percentage, or absolute pixel values to represent position of label |
| 75 | // relative to top-left corner of bounding box. For example: |
| 76 | // |
| 77 | // Absolute pixel values: position: [10, 10], |
| 78 | // Relative percentage: position: ["50%", "50%"] |
| 79 | // |
| 80 | // "top" |
| 81 | // "left" |
| 82 | // "right" |
| 83 | // "bottom" |
| 84 | // "inside" |
| 85 | // "insideLeft" |
| 86 | // "insideRight" |
| 87 | // "insideTop" |
| 88 | // "insideBottom" |
| 89 | // "insideTopLeft" |
| 90 | // "insideBottomLeft" |
| 91 | // "insideTopRight" |
| 92 | // "insideBottomRight" |
| 93 | Position string `json:"position,omitempty"` |
| 94 | |
| 95 | // Data label formatter, which supports string template and callback function. |
| 96 | // In either form, \n is supported to represent a new line. |
| 97 | // String template, Model variation includes: |
| 98 | // |
| 99 | // {a}: series name. |
| 100 | // {b}: the name of a data item. |
| 101 | // {c}: the value of a data item. |
| 102 | // {@xxx}: the value of a dimension named"xxx", for example,{@product}refers the value of"product"` dimension. |
| 103 | // {@[n]}: the value of a dimension at the index ofn, for example,{@[3]}` refers the value at dimensions[3]. |
| 104 | Formatter types.FuncStr `json:"formatter,omitempty"` |
| 105 | } |
| 106 | |
| 107 | // LabelLine Configuration of label guide line. |
| 108 | type LabelLine struct { |
| 109 | // Whether to show the label guide line. |
| 110 | Show types.Bool `json:"show,omitempty"` |
| 111 | // Whether to show the label guide line above the corresponding element. |
| 112 | ShowAbove types.Bool `json:"showAbove"` |
| 113 | // The length of the second segment of guide line. |
| 114 | Length2 float64 `json:"length2,omitempty"` |
| 115 | // smoothness of guide line. |
| 116 | Smooth types.Bool `json:"smooth,omitempty"` |
| 117 | // Minimum turn angle between two segments of guide line |
| 118 | MinTurnAngle float64 `json:"minTurnAngle,omitempty"` |
| 119 | // The style of label line |
| 120 | LineStyle *LineStyle `json:"lineStyle,omitempty"` |
| 121 | } |
| 122 | |
| 123 | // LabelLayout Unified layout configuration of labels |
| 124 | type LabelLayout struct { |
| 125 | // HideOverlap Whether to hide the overlapped labels. |
| 126 | HideOverlap types.Bool `json:"hideOverlap,omitempty"` |
| 127 | // MoveOverlap Whether to hide move the overlapped labels to avoid overlapping. |
| 128 | // Currently supported configurations: |
| 129 | // 'shiftX' Place the labels on horizontal direction sequencely, used when aligned horizontally. |
| 130 | // 'shiftY' Place the labels on vertical direction sequencely, used when aligned vertically. |
| 131 | MoveOverlap string `json:"moveOverlap,omitempty"` |
| 132 | } |
| 133 | |
| 134 | // Blur Configurations of blur state. Whether to blur follows the series. |
| 135 | type Blur struct { |
| 136 | // the blur style of item |
| 137 | ItemStyle *ItemStyle `json:"itemStyle,omitempty"` |
| 138 | |
| 139 | // the blur style of label |
| 140 | Label *Label `json:"label,omitempty"` |
| 141 | } |
| 142 | |
| 143 | // Emphasis is the style when it is highlighted, like being hovered by mouse, or highlighted via legend connect. |
| 144 | type Emphasis struct { |
| 145 | // the emphasis style of label |
| 146 | Label *Label `json:"label,omitempty"` |
| 147 | |
| 148 | // the emphasis style of item |
| 149 | ItemStyle *ItemStyle `json:"itemStyle,omitempty"` |
| 150 | |
| 151 | // Focus configures the behavior of a Sunburst chart when a user interacts with the data. |
| 152 | // When the data is highlighted, whether to fade out of other data to focus the highlighted. |
| 153 | // The following configurations are supported: |
| 154 | // 'none' Do not fade out other data, it's by default. |
| 155 | // 'self' Only focus (not fade out) the element of the currently highlighted data. |
| 156 | // 'series' Focus on all elements of the series which the currently highlighted data belongs to. |
| 157 | // 'ancestor' Focus on all ancestor nodes. |
| 158 | // 'descendant' Focus on all descendants nodes. |
| 159 | // 'relative' Focus on all ancestor and descendants nodes. (Since v5.6.0) |
| 160 | // https://echarts.apache.org/en/option.html#series-sunburst.emphasis.focus |
| 161 | Focus string `json:"focus,omitempty"` |
| 162 | } |
| 163 | |
| 164 | // Animation represents animation behaviors of series. |
| 165 | type Animation struct { |
| 166 | Animation types.Bool `json:"animation,omitempty"` |
| 167 | AnimationThreshold int `json:"animationThreshold,omitempty"` |
| 168 | AnimationDuration int `json:"animationDuration,omitempty"` |
| 169 | AnimationEasing string `json:"animationEasing,omitempty"` |
| 170 | AnimationDelay int `json:"animationDelay,omitempty"` |
| 171 | AnimationDurationUpdate int `json:"animationDurationUpdate,omitempty"` |
| 172 | AnimationEasingUpdate string `json:"animationEasingUpdate,omitempty"` |
| 173 | AnimationDelayUpdate int `json:"animationDelayUpdate,omitempty"` |
| 174 | } |
| 175 | |
| 176 | // ItemStyle represents a style of an item. |
| 177 | type ItemStyle struct { |
| 178 | // Color of chart |
| 179 | // Kline Up candle color |
| 180 | Color string `json:"color,omitempty"` |
| 181 | |
| 182 | // Kline Down candle color |
| 183 | Color0 string `json:"color0,omitempty"` |
| 184 | |
| 185 | // Geo area filling color |
| 186 | AreaColor string `json:"areaColor,omitempty"` |
| 187 | |
| 188 | // BorderRadius configures the radius of items in the chart. |
| 189 | BorderRadius string `json:"borderRadius,omitempty"` |
| 190 | |
| 191 | // BorderColor is the hart border color |
| 192 | // Kline Up candle border color |
| 193 | BorderColor string `json:"borderColor,omitempty"` |
| 194 | |
| 195 | // Kline Down candle border color |
| 196 | BorderColor0 string `json:"borderColor0,omitempty"` |
| 197 | |
| 198 | // Color saturation of a border or gap. |
| 199 | BorderColorSaturation float32 `json:"borderColorSaturation,omitempty"` |
| 200 | |
| 201 | // Border width of a node |
| 202 | BorderWidth float32 `json:"borderWidth,omitempty"` |
| 203 | |
| 204 | // Gaps between child nodes. |
| 205 | GapWidth float32 `json:"gapWidth,omitempty"` |
| 206 | |
| 207 | // Opacity of the component. Supports value from 0 to 1, and the component will not be drawn when set to 0. |
| 208 | Opacity types.Float `json:"opacity,omitempty"` |
| 209 | |
| 210 | // ShadowBlur Size of shadow blur. |
| 211 | // This attribute should be used along with shadowColor,shadowOffsetX, shadowOffsetY to set shadow to component. |
| 212 | ShadowBlur int `json:"shadowBlur,omitempty"` |
| 213 | |
| 214 | // ShadowColor Shadow color. Support same format as color. |
| 215 | ShadowColor string `json:"shadowColor,omitempty"` |
| 216 | |
| 217 | // ShadowOffsetX Offset distance on the horizontal direction of shadow. |
| 218 | ShadowOffsetX int `json:"shadowOffsetX,omitempty"` |
| 219 | |
| 220 | // ShadowOffsetY Offset distance on the vertical direction of shadow. |
| 221 | ShadowOffsetY int `json:"shadowOffsetY,omitempty"` |
| 222 | } |
| 223 | |
| 224 | // MarkLines represents a series of marklines. |
| 225 | type MarkLines struct { |
| 226 | Data []interface{} `json:"data,omitempty"` |
| 227 | MarkLineStyle |
| 228 | } |
| 229 | |
| 230 | // MarkLineStyle contains styling options for a MarkLine. |
| 231 | type MarkLineStyle struct { |
| 232 | // Symbol type at the two ends of the mark line. It can be an array for two ends, or assigned separately. |
| 233 | // Options: "circle", "rect", "roundRect", "triangle", "diamond", "pin", "arrow", "none" |
| 234 | Symbol []string `json:"symbol,omitempty"` |
| 235 | |
| 236 | // Symbol size. |
| 237 | SymbolSize float32 `json:"symbolSize,omitempty"` |
| 238 | |
| 239 | // Mark line text options. |
| 240 | Label *Label `json:"label,omitempty"` |
| 241 | |
| 242 | LineStyle *LineStyle `json:"lineStyle,omitempty"` |
| 243 | |
| 244 | Emphasis *Emphasis `json:"emphasis,omitempty"` |
| 245 | |
| 246 | Blur *Blur `json:"blur,omitempty"` |
| 247 | } |
| 248 | |
| 249 | // CircularStyle contains styling options for circular layout. |
| 250 | type CircularStyle struct { |
| 251 | RotateLabel types.Bool `json:"rotateLabel,omitempty"` |
| 252 | } |
| 253 | |
| 254 | // MarkLineNameTypeItem represents type for a MarkLine. |
| 255 | type MarkLineNameTypeItem struct { |
| 256 | // Mark line name. |
| 257 | Name string `json:"name,omitempty"` |
| 258 | |
| 259 | // Mark line type, options: "average", "min", "max". |
| 260 | Type string `json:"type,omitempty"` |
| 261 | |
| 262 | // Works only when type is assigned. |
| 263 | // It is used to state the dimension used to calculate maximum value or minimum value. |
| 264 | // It may be the direct name of a dimension, like x, |
| 265 | // or angle for line charts, or open, or close for candlestick charts. |
| 266 | ValueDim string `json:"valueDim,omitempty"` |
| 267 | |
| 268 | LineStyle *LineStyle `json:"lineStyle,omitempty"` |
| 269 | } |
| 270 | |
| 271 | // MarkLineNameYAxisItem defines a MarkLine on a Y axis. |
| 272 | type MarkLineNameYAxisItem struct { |
| 273 | // Mark line name |
| 274 | Name string `json:"name,omitempty"` |
| 275 | |
| 276 | // Y axis data |
| 277 | YAxis interface{} `json:"yAxis,omitempty"` |
| 278 | |
| 279 | // Works only when type is assigned. |
| 280 | // It is used to state the dimension used to calculate maximum value or minimum value. |
| 281 | // It may be the direct name of a dimension, like x, |
| 282 | // or angle for line charts, or open, or close for candlestick charts. |
| 283 | ValueDim string `json:"valueDim,omitempty"` |
| 284 | } |
| 285 | |
| 286 | // MarkLineNameXAxisItem defines a MarkLine on a X axis. |
| 287 | type MarkLineNameXAxisItem struct { |
| 288 | // Mark line name |
| 289 | Name string `json:"name,omitempty"` |
| 290 | |
| 291 | // X axis data |
| 292 | XAxis interface{} `json:"xAxis,omitempty"` |
| 293 | |
| 294 | // Works only when type is assigned. |
| 295 | // It is used to state the dimension used to calculate maximum value or minimum value. |
| 296 | // It may be the direct name of a dimension, like x, |
| 297 | // or angle for line charts, or open, or close for candlestick charts. |
| 298 | ValueDim string `json:"valueDim,omitempty"` |
| 299 | } |
| 300 | |
| 301 | // MarkLineNameCoordItem represents coordinates for a MarkLine. |
| 302 | type MarkLineNameCoordItem struct { |
| 303 | // Mark line name |
| 304 | Name string `json:"name,omitempty"` |
| 305 | |
| 306 | // Mark line start coordinate |
| 307 | Coordinate0 []interface{} |
| 308 | |
| 309 | // Mark line end coordinate |
| 310 | Coordinate1 []interface{} |
| 311 | |
| 312 | // Works only when type is assigned. |
| 313 | // It is used to state the dimension used to calculate maximum value or minimum value. |
| 314 | // It may be the direct name of a dimension, like x, |
| 315 | // or angle for line charts, or open, or close for candlestick charts. |
| 316 | ValueDim string `json:"valueDim,omitempty"` |
| 317 | } |
| 318 | |
| 319 | // MarkAreas represents a series of markareas. |
| 320 | type MarkAreas struct { |
| 321 | Data []interface{} `json:"data,omitempty"` |
| 322 | MarkAreaStyle |
| 323 | } |
| 324 | |
| 325 | // MarkAreaData a generic Data struct |
| 326 | type MarkAreaData struct { |
| 327 | Name string `json:"name,omitempty"` |
| 328 | Type string `json:"type,omitempty"` |
| 329 | ValueDim int `json:"valueDim,omitempty"` |
| 330 | Coord interface{} `json:"coord,omitempty"` |
| 331 | X interface{} `json:"x,omitempty"` |
| 332 | Y interface{} `json:"y,omitempty"` |
| 333 | XAxis interface{} `json:"xAxis,omitempty"` |
| 334 | YAxis interface{} `json:"YAxis,omitempty"` |
| 335 | MarkAreaStyle |
| 336 | } |
| 337 | |
| 338 | type MarkAreaData0 struct { |
| 339 | LeftTop MarkAreaData `json:"0,omitempty"` |
| 340 | } |
| 341 | |
| 342 | type MarkAreaData1 struct { |
| 343 | RightBottom MarkAreaData `json:"1,omitempty"` |
| 344 | } |
| 345 | |
| 346 | // MarkAreaStyle contains styling options for a MarkArea. |
| 347 | type MarkAreaStyle struct { |
| 348 | // Mark area text options. |
| 349 | Label *Label `json:"label,omitempty"` |
| 350 | |
| 351 | // ItemStyle settings |
| 352 | ItemStyle *ItemStyle `json:"itemStyle,omitempty"` |
| 353 | |
| 354 | // Emphasis settings |
| 355 | Emphasis *Emphasis `json:"emphasis,omitempty"` |
| 356 | |
| 357 | // Blur settings |
| 358 | Blur *Blur `json:"blur,omitempty"` |
| 359 | } |
| 360 | |
| 361 | // MarkAreaNameTypeItem represents type for a MarkArea. |
| 362 | type MarkAreaNameTypeItem struct { |
| 363 | // Mark area name. |
| 364 | Name string `json:"name,omitempty"` |
| 365 | |
| 366 | // Mark area type, options: "average", "min", "max". |
| 367 | Type string `json:"type,omitempty"` |
| 368 | |
| 369 | // Works only when type is assigned. |
| 370 | // It is used to state the dimension used to calculate maximum value or minimum value. |
| 371 | // It may be the direct name of a dimension, like x, |
| 372 | // or angle for line charts, or open, or close for candlestick charts. |
| 373 | ValueDim string `json:"valueDim,omitempty"` |
| 374 | |
| 375 | // ItemStyle settings |
| 376 | ItemStyle *ItemStyle `json:"itemStyle,omitempty"` |
| 377 | } |
| 378 | |
| 379 | // MarkAreaNameYAxisItem defines a MarkArea on a Y axis. |
| 380 | type MarkAreaNameYAxisItem struct { |
| 381 | // Mark area name |
| 382 | Name string `json:"name,omitempty"` |
| 383 | |
| 384 | // Y axis data |
| 385 | YAxis interface{} `json:"yAxis,omitempty"` |
| 386 | } |
| 387 | |
| 388 | // MarkAreaNameXAxisItem defines a MarkArea on a X axis. |
| 389 | type MarkAreaNameXAxisItem struct { |
| 390 | // Mark area name |
| 391 | Name string `json:"name,omitempty"` |
| 392 | |
| 393 | // X axis data |
| 394 | XAxis interface{} `json:"xAxis,omitempty"` |
| 395 | } |
| 396 | |
| 397 | // MarkAreaNameCoordItem represents coordinates for a MarkArea. |
| 398 | type MarkAreaNameCoordItem struct { |
| 399 | // Mark area name |
| 400 | Name string `json:"name,omitempty"` |
| 401 | |
| 402 | // Mark area start coordinate |
| 403 | Coordinate0 []interface{} |
| 404 | |
| 405 | // Mark area end coordinate |
| 406 | Coordinate1 []interface{} |
| 407 | |
| 408 | // Works only when type is assigned. |
| 409 | // It is used to state the dimension used to calculate maximum value or minimum value. |
| 410 | // It may be the direct name of a dimension, like x, |
| 411 | // or angle for line charts, or open, or close for candlestick charts. |
| 412 | ValueDim string `json:"valueDim,omitempty"` |
| 413 | |
| 414 | // Mark point text options. |
| 415 | Label *Label `json:"label,omitempty"` |
| 416 | |
| 417 | // ItemStyle settings |
| 418 | ItemStyle *ItemStyle `json:"itemStyle,omitempty"` |
| 419 | } |
| 420 | |
| 421 | // MarkPoints represents a series of markpoints. |
| 422 | type MarkPoints struct { |
| 423 | Data []interface{} `json:"data,omitempty"` |
| 424 | MarkPointStyle |
| 425 | } |
| 426 | |
| 427 | // MarkPointStyle contains styling options for a MarkPoint. |
| 428 | type MarkPointStyle struct { |
| 429 | // Symbol type at the two ends of the mark line. It can be an array for two ends, or assigned separately. |
| 430 | // Options: "circle", "rect", "roundRect", "triangle", "diamond", "pin", "arrow", "none" |
| 431 | Symbol []string `json:"symbol,omitempty"` |
| 432 | |
| 433 | // Symbol size. |
| 434 | SymbolSize float32 `json:"symbolSize,omitempty"` |
| 435 | |
| 436 | // Symbol rotate. |
| 437 | SymbolRotate float32 `json:"symbolRotate,omitempty"` |
| 438 | |
| 439 | // Mark point text options. |
| 440 | Label *Label `json:"label,omitempty"` |
| 441 | } |
| 442 | |
| 443 | // MarkPointNameTypeItem represents type for a MarkPoint. |
| 444 | type MarkPointNameTypeItem struct { |
| 445 | // Name of markpoint |
| 446 | Name string `json:"name,omitempty"` |
| 447 | |
| 448 | // Mark point type, options: "average", "min", "max". |
| 449 | Type string `json:"type,omitempty"` |
| 450 | |
| 451 | // Works only when type is assigned. |
| 452 | // It is used to state the dimension used to calculate maximum value or minimum value. |
| 453 | // It may be the direct name of a dimension, like x, |
| 454 | // or angle for line charts, or open, or close for candlestick charts. |
| 455 | ValueDim string `json:"valueDim,omitempty"` |
| 456 | |
| 457 | // ItemStyle settings |
| 458 | ItemStyle *ItemStyle `json:"itemStyle,omitempty"` |
| 459 | } |
| 460 | |
| 461 | // MarkPointNameCoordItem represents coordinates for a MarkPoint. |
| 462 | type MarkPointNameCoordItem struct { |
| 463 | // Name of markpoint |
| 464 | Name string `json:"name,omitempty"` |
| 465 | |
| 466 | // Mark point coordinate |
| 467 | Coordinate []interface{} `json:"coord,omitempty"` |
| 468 | |
| 469 | // Value in mark point |
| 470 | Value string `json:"value,omitempty"` |
| 471 | |
| 472 | // Works only when type is assigned. |
| 473 | // It is used to state the dimension used to calculate maximum value or minimum value. |
| 474 | // It may be the direct name of a dimension, like x, |
| 475 | // or angle for line charts, or open, or close for candlestick charts. |
| 476 | ValueDim string `json:"valueDim,omitempty"` |
| 477 | |
| 478 | // Mark point text options. |
| 479 | Label *Label `json:"label,omitempty"` |
| 480 | |
| 481 | // ItemStyle settings |
| 482 | ItemStyle *ItemStyle `json:"itemStyle,omitempty"` |
| 483 | |
| 484 | // Symbol type |
| 485 | // Options: "circle", "rect", "roundRect", "triangle", "diamond", "pin", "arrow", "none" |
| 486 | Symbol string `json:"symbol,omitempty"` |
| 487 | |
| 488 | // Symbol size. |
| 489 | SymbolSize float32 `json:"symbolSize,omitempty"` |
| 490 | |
| 491 | // Symbol rotate. |
| 492 | SymbolRotate float32 `json:"symbolRotate,omitempty"` |
| 493 | } |
| 494 | |
| 495 | // RippleEffect is the option set for the ripple effect. |
| 496 | type RippleEffect struct { |
| 497 | // The period duration of animation, in seconds. |
| 498 | // default 4(s) |
| 499 | Period float32 `json:"period,omitempty"` |
| 500 | |
| 501 | // The maximum zooming scale of ripples in animation. |
| 502 | // default 2.5 |
| 503 | Scale float32 `json:"scale,omitempty"` |
| 504 | |
| 505 | // The brush type for ripples. options: "stroke" and "fill". |
| 506 | // default "fill" |
| 507 | BrushType string `json:"brushType,omitempty"` |
| 508 | } |
| 509 | |
| 510 | // LineStyle is the option set for a link style component. |
| 511 | type LineStyle struct { |
| 512 | // Line color |
| 513 | Color string `json:"color,omitempty"` |
| 514 | |
| 515 | // Width of line. default 1 |
| 516 | Width float32 `json:"width,omitempty"` |
| 517 | |
| 518 | // Type of line,options: "solid", "dashed", "dotted". default "solid" |
| 519 | Type string `json:"type,omitempty"` |
| 520 | |
| 521 | // Opacity of the component. Supports value from 0 to 1, and the component will not be drawn when set to 0. |
| 522 | Opacity types.Float `json:"opacity,omitempty"` |
| 523 | |
| 524 | // Curveness of edge. The values from 0 to 1 could be set. |
| 525 | // it would be larger as the the value becomes larger. default 0 |
| 526 | Curveness float32 `json:"curveness,omitempty"` |
| 527 | } |
| 528 | |
| 529 | // AreaStyle is the option set for an area style component. |
| 530 | type AreaStyle struct { |
| 531 | // Fill area color. |
| 532 | Color string `json:"color,omitempty"` |
| 533 | |
| 534 | // Origin position of area. |
| 535 | // By default, the area between axis line and data will be filled. |
| 536 | // This config enables you to fill the area from data to the max or min of the axis data or a specified value. |
| 537 | // Valid values: |
| 538 | // 'auto' to fill between axis line and data (Default) |
| 539 | // 'start' to fill between min axis value (when not inverse) and data |
| 540 | // 'end' to fill between max axis value (when not inverse) and data |
| 541 | // number to fill between specified value and data |
| 542 | Origin string `json:"origin,omitempty"` |
| 543 | |
| 544 | // Opacity of the component. Supports value from 0 to 1, and the component will not be drawn when set to 0. |
| 545 | Opacity types.Float `json:"opacity,omitempty"` |
| 546 | } |
| 547 | |
| 548 | // GraphForce Configuration items about force-directed layout. Force-directed layout simulates |
| 549 | // spring/charge model, which will add a repulsion between 2 nodes and add a attraction |
| 550 | // between 2 nodes of each edge. In each iteration nodes will move under the effect |
| 551 | // of repulsion and attraction. After several iterations, the nodes will be static in a |
| 552 | // balanced position. As a result, the energy local minimum of this whole model will be realized. |
| 553 | // The result of force-directed layout has a good symmetries and clustering, which is also aesthetically pleasing. |
| 554 | type GraphForce struct { |
| 555 | // The initial layout before force-directed layout, which will influence on the result of force-directed layout. |
| 556 | // It defaults not to do any layout and use x, y provided in node as the position of node. |
| 557 | // If it doesn't exist, the position will be generated randomly. |
| 558 | // You can also use circular layout "circular". |
| 559 | InitLayout string `json:"initLayout,omitempty"` |
| 560 | |
| 561 | // The repulsion factor between nodes. The repulsion will be stronger and the distance |
| 562 | // between 2 nodes becomes further as this value becomes larger. |
| 563 | // It can be an array to represent the range of repulsion. In this case larger value have larger |
| 564 | // repulsion and smaller value will have smaller repulsion. |
| 565 | Repulsion float32 `json:"repulsion,omitempty"` |
| 566 | |
| 567 | // The gravity factor enforcing nodes approach to the center. The nodes will be |
| 568 | // closer to the center as the value becomes larger. default 0.1 |
| 569 | Gravity float32 `json:"gravity,omitempty"` |
| 570 | |
| 571 | // The distance between 2 nodes on edge. This distance is also affected by repulsion. |
| 572 | // It can be an array to represent the range of edge length. In this case edge with larger |
| 573 | // value will be shorter, which means two nodes are closer. And edge with smaller value will be longer. |
| 574 | // default 30 |
| 575 | // It can be an array to represent the range of edge length. In this case edge with larger value will |
| 576 | // be shorter, which means two nodes are closer. And edge with smaller value will be longer. |
| 577 | EdgeLength interface{} `json:"edgeLength,omitempty"` |
| 578 | } |
| 579 | |
| 580 | // TreeLeaves Leaf node special configuration, the leaf node and non-leaf node label location is different. |
| 581 | type TreeLeaves struct { |
| 582 | // The style setting of the text label in a single bar. |
| 583 | Label *Label `json:"label,omitempty"` |
| 584 | |
| 585 | // LineStyle settings in this series data. |
| 586 | LineStyle *LineStyle `json:"lineStyle,omitempty"` |
| 587 | |
| 588 | // ItemStyle settings in this series data. |
| 589 | ItemStyle *ItemStyle `json:"itemStyle,omitempty"` |
| 590 | |
| 591 | // Emphasis settings in this series data. |
| 592 | Emphasis *Emphasis `json:"emphasis,omitempty"` |
| 593 | } |
| 594 | |
| 595 | // TreeMapLevel is level specific configuration. |
| 596 | type TreeMapLevel struct { |
| 597 | // Color defines a list for a node level, if empty, retreived from global color list. |
| 598 | Color []string `json:"color,omitempty"` |
| 599 | |
| 600 | // ColorAlpha indicates the range of tranparent rate (color alpha) for nodes in a level. |
| 601 | ColorAlpha []float32 `json:"colorAlpha,omitempty"` |
| 602 | |
| 603 | // ColorSaturation indicates the range of saturation (color alpha) for nodes in a level. |
| 604 | ColorSaturation []float32 `json:"colorSaturation,omitempty"` |
| 605 | |
| 606 | // ColorMappingBy specifies the rule according to which each node obtain color from color list. |
| 607 | ColorMappingBy string `json:"colorMappingBy,omitempty"` |
| 608 | |
| 609 | // UpperLabel is used to specify whether show label when the treemap node has children. |
| 610 | UpperLabel *UpperLabel `json:"upperLabel,omitempty"` |
| 611 | |
| 612 | // ItemStyle settings in this series data. |
| 613 | ItemStyle *ItemStyle `json:"itemStyle,omitempty"` |
| 614 | |
| 615 | // Emphasis settings in this series data. |
| 616 | Emphasis *Emphasis `json:"emphasis,omitempty"` |
| 617 | } |
| 618 | |
| 619 | // UpperLabel is used to specify whether show label when the treemap node has children. |
| 620 | // https://echarts.apache.org/en/option.html#series-treemap.upperLabel |
| 621 | type UpperLabel struct { |
| 622 | // Show is true to show upper label. |
| 623 | Show types.Bool `json:"show,omitempty"` |
| 624 | |
| 625 | // Position is the label's position. |
| 626 | // * top |
| 627 | // * left |
| 628 | // * right |
| 629 | // * bottom |
| 630 | // * inside |
| 631 | // * insideLeft |
| 632 | // * insideRight |
| 633 | // * insideTop |
| 634 | // * insideBottom |
| 635 | // * insideTopLeft |
| 636 | // * insideBottomLeft |
| 637 | // * insideTopRight |
| 638 | // * insideBottomRight |
| 639 | Position string `json:"position,omitempty"` |
| 640 | |
| 641 | // Distance to the host graphic element. |
| 642 | // It is valid only when position is string value (like 'top', 'insideRight'). |
| 643 | Distance float32 `json:"distance,omitempty"` |
| 644 | |
| 645 | // Rotate label, from -90 degree to 90, positive value represents rotate anti-clockwise. |
| 646 | Rotate float32 `json:"rotate,omitempty"` |
| 647 | |
| 648 | // Whether to move text slightly. For example: [30, 40] means move 30 horizontally and move 40 vertically. |
| 649 | Offset []float32 `json:"offset,omitempty"` |
| 650 | |
| 651 | // Color is the text color |
| 652 | Color string `json:"color,omitempty"` |
| 653 | |
| 654 | // FontStyle |
| 655 | // * "normal" |
| 656 | // * "italic" |
| 657 | // * "oblique" |
| 658 | FontStyle string `json:"fontStyle,omitempty"` |
| 659 | |
| 660 | // FontWeight can be the string or a number |
| 661 | // * "normal" |
| 662 | // * "bold" |
| 663 | // * "bolder" |
| 664 | // * "lighter" |
| 665 | // 100 | 200 | 300| 400 ... |
| 666 | FontWeight interface{} `json:"fontWeight,omitempty"` |
| 667 | |
| 668 | // FontSize |
| 669 | FontSize float32 `json:"fontSize,omitempty"` |
| 670 | |
| 671 | // Align is a horizontal alignment of text, automatic by default. |
| 672 | // * "left" |
| 673 | // * "center" |
| 674 | // * "right" |
| 675 | Align string `json:"align,omitempty"` |
| 676 | |
| 677 | // Align is a horizontal alignment of text, automatic by default. |
| 678 | // * "top" |
| 679 | // * "middle" |
| 680 | // * "bottom" |
| 681 | VerticalAlign string `json:"verticalAlign,omitempty"` |
| 682 | |
| 683 | // Padding of the text fragment, for example: |
| 684 | // Padding: [3, 4, 5, 6]: represents padding of [top, right, bottom, left]. |
| 685 | // Padding: 4: represents padding: [4, 4, 4, 4]. |
| 686 | // Padding: [3, 4]: represents padding: [3, 4, 3, 4]. |
| 687 | Padding interface{} `json:"padding,omitempty"` |
| 688 | |
| 689 | // Width of text block |
| 690 | Width float32 `json:"width,omitempty"` |
| 691 | |
| 692 | // Height of text block |
| 693 | Height float32 `json:"height,omitempty"` |
| 694 | |
| 695 | // Upper label formatter, which supports string template and callback function. |
| 696 | // In either form, \n is supported to represent a new line. |
| 697 | // String template, Model variation includes: |
| 698 | // |
| 699 | // {a}: series name. |
| 700 | // {b}: the name of a data item. |
| 701 | // {c}: the value of a data item. |
| 702 | // {@xxx}: the value of a dimension named"xxx", for example,{@product}refers the value of"product"` dimension. |
| 703 | // {@[n]}: the value of a dimension at the index ofn, for example,{@[3]}` refers the value at dimensions[3]. |
| 704 | Formatter string `json:"formatter,omitempty"` |
| 705 | } |
| 706 | |
| 707 | // RGBColor returns the color with RGB format |
| 708 | func RGBColor(r, g, b uint16) string { |
| 709 | return fmt.Sprintf("rgb(%d,%d,%d)", r, g, b) |
| 710 | } |
| 711 | |
| 712 | // RGBAColor returns the color with RGBA format |
| 713 | func RGBAColor(r, g, b uint16, a float32) string { |
| 714 | return fmt.Sprintf("rgba(%d,%d,%d,%f)", r, g, b, a) |
| 715 | } |
| 716 | |
| 717 | // HSLColor returns the color with HSL format |
| 718 | func HSLColor(h, s, l float32) string { |
| 719 | return fmt.Sprintf("hsl(%f,%f%%,%f%%)", h, s, l) |
| 720 | } |
| 721 | |
| 722 | // HSLAColor returns the color with HSLA format |
| 723 | func HSLAColor(h, s, l, a float32) string { |
| 724 | return fmt.Sprintf("hsla(%f,%f%%,%f%%,%f)", h, s, l, a) |
| 725 | } |
| 726 | |
| 727 | // EdgeLabel is the properties of an label of edge. |
| 728 | // https://echarts.apache.org/en/option.html#series-graph.edgeLabel |
| 729 | type EdgeLabel struct { |
| 730 | // Show is true to show label on edge. |
| 731 | Show types.Bool `json:"show,omitempty"` |
| 732 | |
| 733 | // Position is the label's position in line of edge. |
| 734 | // * "start" |
| 735 | // * "middle" |
| 736 | // * "end" |
| 737 | Position string `json:"position,omitempty"` |
| 738 | |
| 739 | // Color is the text color |
| 740 | Color string `json:"color,omitempty"` |
| 741 | |
| 742 | // FontStyle |
| 743 | // * "normal" |
| 744 | // * "italic" |
| 745 | // * "oblique" |
| 746 | FontStyle string `json:"fontStyle,omitempty"` |
| 747 | |
| 748 | // FontWeight can be the string or a number |
| 749 | // * "normal" |
| 750 | // * "bold" |
| 751 | // * "bolder" |
| 752 | // * "lighter" |
| 753 | // 100 | 200 | 300| 400 ... |
| 754 | FontWeight interface{} `json:"fontWeight,omitempty"` |
| 755 | |
| 756 | // FontSize |
| 757 | FontSize float32 `json:"fontSize,omitempty"` |
| 758 | |
| 759 | // Align is a horizontal alignment of text, automatic by default. |
| 760 | // * "left" |
| 761 | // * "center" |
| 762 | // * "right" |
| 763 | Align string `json:"align,omitempty"` |
| 764 | |
| 765 | // Align is a horizontal alignment of text, automatic by default. |
| 766 | // * "top" |
| 767 | // * "middle" |
| 768 | // * "bottom" |
| 769 | VerticalAlign string `json:"verticalAlign,omitempty"` |
| 770 | |
| 771 | // Padding of the text fragment, for example: |
| 772 | // Padding: [3, 4, 5, 6]: represents padding of [top, right, bottom, left]. |
| 773 | // Padding: 4: represents padding: [4, 4, 4, 4]. |
| 774 | // Padding: [3, 4]: represents padding: [3, 4, 3, 4]. |
| 775 | Padding interface{} `json:"padding,omitempty"` |
| 776 | |
| 777 | // Width of text block |
| 778 | Width float32 `json:"width,omitempty"` |
| 779 | |
| 780 | // Height of text block |
| 781 | Height float32 `json:"height,omitempty"` |
| 782 | |
| 783 | // Edge label formatter, which supports string template and callback function. |
| 784 | // In either form, \n is supported to represent a new line. |
| 785 | // String template, Model variation includes: |
| 786 | // |
| 787 | // {a}: series name. |
| 788 | // {b}: the name of a data item. |
| 789 | // {c}: the value of a data item. |
| 790 | // {@xxx}: the value of a dimension named"xxx", for example,{@product}refers the value of"product"` dimension. |
| 791 | // {@[n]}: the value of a dimension at the index ofn, for example,{@[3]}` refers the value at dimensions[3]. |
| 792 | Formatter string `json:"formatter,omitempty"` |
| 793 | } |
| 794 | |
| 795 | // Encode Define what is encoded to for each dimension of data |
| 796 | // https://echarts.apache.org/en/option.html#series-candlestick.encode |
| 797 | type Encode struct { |
| 798 | X interface{} `json:"x"` |
| 799 | |
| 800 | Y interface{} `json:"y"` |
| 801 | |
| 802 | Tooltip interface{} `json:"tooltip,omitempty"` |
| 803 | |
| 804 | SeriesName interface{} `json:"seriesName,omitempty"` |
| 805 | |
| 806 | ItemID interface{} `json:"itemId,omitempty"` |
| 807 | |
| 808 | ItemName interface{} `json:"itemName,omitempty"` |
| 809 | |
| 810 | ItemGroupID interface{} `json:"itemGroupId,omitempty"` |
| 811 | } |
| 812 | |
| 813 | // SeriesTooltip is the option set for a tooltip component within series. |
| 814 | // e.g. https://echarts.apache.org/en/option.html#series-line.tooltip |
| 815 | type SeriesTooltip struct { |
| 816 | // The content formatter of tooltip's floating layer which supports string template and callback function. |
| 817 | // |
| 818 | // 1. String template |
| 819 | // The template variables are {a}, {b}, {c}, {d} and {e}, which stands for series name, |
| 820 | // data name and data value and ect. When trigger is set to be 'axis', there may be data from multiple series. |
| 821 | // In this time, series index can be refereed as {a0}, {a1}, or {a2}. |
| 822 | // {a}, {b}, {c}, {d} have different meanings for different series types: |
| 823 | // |
| 824 | // * Line (area) charts, bar (column) charts, K charts: {a} for series name, |
| 825 | // {b} for category name, {c} for data value, {d} for none; |
| 826 | // * Scatter (bubble) charts: {a} for series name, {b} for data name, {c} for data value, {d} for none; |
| 827 | // * Map: {a} for series name, {b} for area name, {c} for merging data, {d} for none; |
| 828 | // * Pie charts, gauge charts, funnel charts: {a} for series name, {b} for data item name, |
| 829 | // {c} for data value, {d} for percentage. |
| 830 | // |
| 831 | // 2. Callback function |
| 832 | // The format of callback function: |
| 833 | // (params: Object|Array, ticket: string, callback: (ticket: string, html: string)) => string |
| 834 | // The first parameter params is the data that the formatter needs. Its format is shown as follows: |
| 835 | // { |
| 836 | // componentType: 'series', |
| 837 | // // Series type |
| 838 | // seriesType: string, |
| 839 | // // Series index in option.series |
| 840 | // seriesIndex: number, |
| 841 | // // Series name |
| 842 | // seriesName: string, |
| 843 | // // Data name, or category name |
| 844 | // name: string, |
| 845 | // // Data index in input data array |
| 846 | // dataIndex: number, |
| 847 | // // Original data as input |
| 848 | // data: Object, |
| 849 | // // Value of data. In most series it is the same as data. |
| 850 | // // But in some series it is some part of the data (e.g., in map, radar) |
| 851 | // value: number|Array|Object, |
| 852 | // // encoding info of coordinate system |
| 853 | // // Key: coord, like ('x' 'y' 'radius' 'angle') |
| 854 | // // value: Must be an array, not null/undefined. Contain dimension indices, like: |
| 855 | // // { |
| 856 | // // x: [2] // values on dimension index 2 are mapped to x axis. |
| 857 | // // y: [0] // values on dimension index 0 are mapped to y axis. |
| 858 | // // } |
| 859 | // encode: Object, |
| 860 | // // dimension names list |
| 861 | // dimensionNames: Array<String>, |
| 862 | // // data dimension index, for example 0 or 1 or 2 ... |
| 863 | // // Only work in `radar` series. |
| 864 | // dimensionIndex: number, |
| 865 | // // Color of data |
| 866 | // color: string, |
| 867 | // |
| 868 | // // the percentage of pie chart |
| 869 | // percent: number, |
| 870 | // } |
| 871 | Formatter types.FuncStr `json:"formatter,omitempty"` |
| 872 | |
| 873 | // ValueFormatter Callback function for formatting the value section in tooltip. |
| 874 | // valueFormatter: (value) => '$' + value.toFixed(2) |
| 875 | ValueFormatter types.FuncStr `json:"valueFormatter,omitempty"` |
| 876 | |
| 877 | // The content formatter of tooltip's floating layer which supports string template and callback function. |
| 878 | // See https://echarts.apache.org/en/option.html#grid.tooltip.position |
| 879 | // May be a string ("inside", "top", "bottom", "left", "right") or a function of form: |
| 880 | // (point: Array, params: Object|Array.<Object>, dom: HTMLDomElement, rect: Object, size: Object) => Array |
| 881 | Position types.FuncStr `json:"position,omitempty"` |
| 882 | |
| 883 | // The border color of tooltip's floating layer. |
| 884 | BorderColor string `json:"borderColor,omitempty"` |
| 885 | |
| 886 | // The background color of tooltip's floating layer. e.g. 'rgba(50,50,50,0.7)' |
| 887 | BackgroundColor string `json:"backgroundColor,omitempty"` |
| 888 | |
| 889 | // Text style |
| 890 | TextStyle *TextStyle `json:"textStyle,omitempty"` |
| 891 | } |