Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Highcharts Configuration Options in Detail

Highcharts Configuration Options in Detail

Highcharts provides a large number of configuration options and parameters, allowing you to easily customize charts to meet user requirements. This chapter introduces the use of Highcharts configuration options in detail:


Parameter Configuration (Properties + Events)

  1. chart.events.addSeries: Add a data series to the chart.

  2. chart.events.click: The click event that occurs on the chart's plotting area.

  3. chart.events.load: The chart load event.

  4. chart.events.redraw: The chart redraw event, triggered when clicking a legend to show or hide a plot.

  5. chart.events.selection: When the chart curve can be selected for zooming, this event can be triggered when a chart selection operation occurs.

  6. chart.height: The height value of the drawn chart.

  7. chart.inverted: Swap the X and Y axes in the chart.

  8. chart.polar: Whether it is a polar chart.

  9. chart.reflow: When the window size changes, the chart width automatically adapts to the window size change.

  10. chart.renderTo: The location where the chart is loaded, a DOM object on the page.

  11. chart.showAxes: Whether to show the axes in an empty chart.

  12. chart.type: The chart type, default is line, and there are alsobar/column/pie……

  13. chart.width: The width of the chart's plotting area, default is auto.

  14. chart.zoomType: The zoom type of the data report in the chart, which can zoom along the X axis, the Y axis, or both XY axes at the same time.

  15. colors: The colors between data series when there are many columns in the chart. It is an array and is generally not modified.

  16. credits.enabled: Whether to allow displaying copyright information.

  17. credits.href: The link to the copyright owner.

  18. credits.text: The text displayed for the copyright information.

  19. exporting.buttons.exportButton.enabled: Whether to allow displaying the export button.

  20. exporting.buttons.exportButton.menuItems: The menu options of the export button.

  21. exporting.buttons.exportButton.onclick: The event when the export button is clicked, not the internal menu.

  22. exporting.buttons.printButton.enabled: Whether to allow the print button.

  23. exporting.buttons.printButton.onclick: The click event of the print button.

  24. exporting.enabled: Whether the print and export buttons are enabled.

  25. exporting.filename: The filename of the exported file.

  26. exporting.type: The default file format of the exported image.

  27. exporting.url: The endpoint URL that handles SVG chart conversion and export.

  28. exporing.width: The default width of the exported image.

  29. labels: A tag that can be loaded anywhere on the chart, containing items and style.

  30. lang: Language configuration, including settings related to the export button menu, time and date names, etc.

  31. legend.enabled: Whether to enable the legend.

  32. navigation.buttonOptions.enabled: Whether all navigation buttons in the chart are clickable.

  33. plotOptions.area.allowPointSelect: Whether to allow clicking on data points.

  34. plotOptions.area.color: The color of the plot.

  35. plotOptions.area.dataLabels.enabled: Whether to enable data labels.

  36. plotOptions.area.enableMouseTracking: Whether to enable mouse-tracking tooltips for data points in the chart.

  37. plotOptions.area.events.checkboxClick: The click event on a checkbox in the chart legend.

  38. plotOptions.area.events.click: The click event on a data point in the chart.

  39. plotOptions.area.events.hide: The event triggered when a data series is hidden in the chart.

  40. plotOptions.area.events.show: The event triggered when a data series is shown in the chart.

  41. plotOptions.area.events.legendItemClick: The event triggered when an item in the chart legend is clicked; setting it directly to false makes it non-clickable.

  42. plotOptions.area.events.mouseOut: The mouse-out event on a data point.

  43. plotOptions.area.events.mouseOver: The mouse-over event on a data point.

  44. plotOptions.area.marker.enabled: Whether to show point markers in the plot.

  45. plotOptions.area.marker.states.hover.enabled: Whether to enable the hover state of markers.

  46. plotOptions.area.marker.states.select.enabled: Whether to enable the select state of markers.

  47. plotOptions.area.point.events.click: The click event on each individual point in the chart.

  48. plotOptions.area.point.events.mouseOut

  49. plotOptions.area.point.events..mouseOver

  50. plotOptions.area.point.events.remove: The event triggered when a point is removed from the chart.

  51. plotOptions.area.point.events.select: The point selection event in the chart.

  52. plotOptions.area.point.events.unselect: The event triggered when a point is deselected in the chart.

  53. plotOptions.area.point.events.update: The event triggered when data in the chart is updated.

  54. plotOptions.area.visible: Whether a data series is shown or hidden by default on load.

  55. plotOptions.area.zIndex: In the case of multiple series, adjusts the stacking order of each series.

  56. The point.events above also apply to other area-type charts (arearange, areaspline, areasplinerange), other column-type charts (bar, column), and all charts.

  57. plotOptions.area.showInLegend: Whether to show it in the legend.

  58. plotOptions.area.stacking: Whether to stack by value or by percentage.

  59. plotOptions.area.states.hover.enabled: Whether to enable the hover state.

  60. plotOptions.area.stickyTracking: Sticky mouse tracking of data points.

  61. plotOptions.arearange, plotOptions.areaspline, and plotOptions.areasplinerange are similar to plotOptions.area

  62. plotOptions.bar.groupPadding: For grouped bar charts, the padding between groups.

  63. plotOptions.bar.grouping: Whether to group the data.

  64. plotOptions.bar.minPointLength:: Defines the minimum length of a point when its value is zero

  65. plotOptions.bar.showInLegend: Whether to show it in the legend.

  66. plotOptions.bar.stacking: Whether to stack by value or by percentage (normal/percent).

  67. plotOptions.column and plotOptions.columnrange are similar to plotOptions.bar

  68. The configuration of plotOptions.line is similar to that of plotOptions.area.

  69. plotOptions.pie.ignoreHiddenPoint: In a pie chart, when a series is hidden by clicking the legend, whether the whole pie is redistributed to 100%, or simply hidden on the original chart leaving a gap.

  70. plotOptions.pie.innerSize: When drawing a pie chart, how much blank space is reserved at the center.

  71. plotOptions.pie.slicedOffset: Used together with allowPointSelect; when a point is clicked, the corresponding slice is pulled out, and this parameter configures the offset distance.

  72. Other common configuration parameters of plotOptions.pie are similar to plotOptions.area; the configurations of plotOptions.scatter, plotOptions.series, and plotOptions.spline are similar to plotOptions.area.

  73. series: It is an array.

  74. series.data.color: The color of a particular data item.

  75. series.data.dataLabels: The data label of a particular data item in the series.

  76. series.data.events is similar to the configuration of plotOptions.area.point.events.

  77. series.data.marker is similar to the configuration of plotOptions.area.marker.

  78. series.data.name: Configures the name of the data point.

  79. series.data.sliced: In a pie chart, configures the separation distance of a slice.

  80. series.data.x: The x value of the point.

  81. series.data.y: The y value of the point.

  82. series.name: The name of the data series.

  83. series.stack: The group index for stacking.

  84. series.type: The display type of the data series.

  85. series.xAxis, series.yAxis: When using multiple axes, specifies which axis a series corresponds to.

  86. subtitle: Configures the subtitle of the chart.

  87. title: Configures the title of the chart.

  88. tooltip: Configures the tooltips for data in the chart.

  89. tooltip.valueDecimals: The number of decimal places allowed.

  90. tooltip.percentageDecimals: The number of decimal places allowed for percentages.

  91. xAxis, yAxis configures and sets the axes

  92. allowDecimals: Whether decimals are allowed on the axis.

  93. categories: An array of categories for the axis.

  94. plotLines: Draws plot lines.

  95. tickColor: The color of the tick marks.

  96. tickInterval: The interval step of the ticks.

  97. labels.rotation: The rotation angle of the tick labels

Chart: Chart area options

The Chart options are used to set properties related to the chart area.

Parameters Description Default value
backgroundColor Sets the background color of the chart area #FFFFFF
borderWidth Sets the border width of the chart 0
borderRadius Sets the border radius of the chart 5
renderTo The container where the chart is placed; typically a DIV is placed in the HTML and its id attribute value is obtained null
defaultSeriesType Default chart types: line, spline, area, areaspline, column, bar, pie, scatter 0
width The chart width; by default it adapts to the width of the chart container null
height The chart height; by default it adapts to the height of the chart container null
margin Sets the spacing between the chart and other elements, as an array, e.g., [0,0,0,0] [null]
plotBackgroundColor The background color of the main chart area, i.e., the area enclosed by the X and Y axes null
plotBorderColor The border color of the main chart area, i.e., the border color of the area enclosed by the X and Y axes null
plotBorderWidth The border width of the main chart area 0
shadow Whether to enable a shadow; requires the backgroundColor to be set. false
reflow Whether to automatically use the chart area's height and width; if width and height are not set, the size adapts automatically. true
zoomType Zoom by dragging the mouse, along the x-axis or y-axis; can be set to: 'x', 'y', 'xy' ''
events Event callbacks; supports callback functions for the addSeries, click, load, selection methods, etc.  

Color: Color options

The Color options are used to set the color scheme of the chart.

Parameters Description Default value
color Used to display the colors of line, column, pie and other charts, in array form. array

Highcharts provides several color schemes by default. When there are more shapes to display than colors available, the extra shapes automatically start again from the first color scheme. How to customize the color scheme:



Highcharts.setOptions({

    colors: ['#058DC7', '#50B432', '#ED561B', '#DDDF00', '#24CBE5', '#64E572', '#FF9655',

'#FFF263', '#6AF9C4']

});


Title: Title options

The Title options are used to set properties related to the chart title.

Parameters Description Default value
text The title text content. Chart title
align The horizontal alignment. center
verticalAlign The vertical alignment. top
margin The spacing between the title and subtitle, or between the main chart areas. 15
floating Whether to float; if true, the title can be offset from the main chart area and can be used together with the x and y properties. false
style Sets the CSS style. {color: '#3E576F',
fontSize: '16px'}

Subtitle: Subtitle options

The properties provided by the subtitle are roughly the same as those of the title; refer to the title options above. It is worth noting that the subtitle's text option defaults to '', i.e., empty, so the subtitle is not displayed by default.


xAxis: X-axis options

The X-axis options are used to set properties related to the chart's X axis.

Parameters Description Default value
categories Sets the X-axis category names, as an array, e.g., categories: ['Apples', 'Bananas', 'Oranges'] []
title The X-axis name; supports properties such as text, enabled, align, rotation, style, etc.  
labels Sets the style of each X-axis category name, the formatter format, the rotation angle, etc. array
max The X-axis maximum value (when categories is empty); if null, the maximum is automatically matched based on the X-axis data. null
min The X-axis minimum value (when categories is empty); if null, the minimum is automatically matched based on the X-axis data. array
gridLineColor Grid (vertical line) color #C0C0C0
gridLineWidth Grid (vertical line) width 1
lineColor Baseline color #C0D0E0
lineWidth Baseline width 0

yAxis: Y-axis options

The Y-axis options are basically the same as the xAxis options above; refer to the parameters in the table above, and they are not listed separately.


Series: Data series options

The data series options are used to set properties related to the data displayed in the chart.

Parameters Description Default value
data The data series displayed in the chart, which can be an array or JSON-formatted data. E.g., data:[0, 5, 3, 5], or
data: [{name: 'Point 1',y: 0}, {name: 'Point 2',y: 5}] ''
name Displays the name of the data series. ''
type The data series type; supports area, areaspline, bar, column, line, pie, scatter or spline line

plotOptions: Data Point Options

plotOptions is used to set properties related to the data points in the chart. The property settings of plotOptions vary slightly depending on the chart type; the common options are listed below.

Parameters Description Default value
enabled Whether to display data directly on the data points false
allowPointSelect Whether to allow selecting data points with the mouse false
formatter A callback function that formats the displayed data content formatter: function() {return this.y;}

Tooltip: Data point tooltip

Tooltip is used to set the information displayed in the tooltip when the mouse hovers over a data point.

Parameters Description Default value
enabled Whether to display the tooltip true
backgroundColor Sets the background color of the tooltip rgba(255, 255, 255, .85)
borderColor The tooltip border color; by default it automatically matches the color of the data series auto
borderRadius The tooltip border radius 5
shadow Whether to display the tooltip shadow true
style Sets the tooltip content style, such as font color, etc. color:'#333'
formatter A callback function used to format the output content of the tooltip. The returned content supports html tags such as:, , , ,
,
2

Legend: Legend options

legend is used to set properties related to the legend.

Parameters Description Default value
layout The display layout; supports horizontal and vertical horizontal
align The alignment. center
backgroundColor The legend background color. null
borderColor The legend border color. #909090
borderRadius The legend border radius 5
enabled Whether to show the legend true
floating Whether it can float, used together with the x and y properties. false
shadow Whether to display a shadow false
style Sets the legend content style ''

For more detailed information, please refer to the English documentation on the Highcharts official website:http://api.highcharts.com/highcharts