// Highcharts CheatSheet Part 2. // Create interactive charts easily for your web projects. // Download: http://www.highcharts.com/download // More: http://api.highcharts.com/highcharts // 3. Create your chart. //
// http://api.highcharts.com/highcharts#chart $(function () { $('#container').highcharts({ chart: { alignTicks: true, // When using multiple axis, the ticks of two or more opposite axes will automatically be aligned by adding ticks to the axis or axes with the least ticks. animation: true, // Set the overall animation for all chart updating. Animation can be disabled throughout the chart by setting it to false here. backgroundColor: '#FFF', // The background color or gradient for the outer chart area. borderColor: '#4572A7', // The color of the outer chart border. borderRadius: 5, // The corner radius of the outer chart border. In export, the radius defaults to 0. Defaults to 5. borderWidth: 0, // The pixel width of the outer chart border. className: null, // A CSS class name to apply to the charts container div, allowing unique CSS styling for each chart. defaultSeriesType: 'line', // Alias of type. events: { addSeries: null, // Fires when a series is added to the chart after load time, using the addSeries method. The this keyword refers to the chart object itself. One parameter, event, is passed to the function. click: null, // Fires when clicking on the plot background. The this keyword refers to the chart object itself. One parameter, event, is passed to the function. drilldown: null, // Fires when a drilldown point is clicked, before the new series is added. Event arguments include point for the originating point, and seriesOptions for the new series. drillup: null, // Fires when drilling up from a drilldown series. load: null, // Fires when the chart is finished loading. The this keyword refers to the chart object itself. One parameter, event, is passed to the function. redraw: null, // Fires when the chart is redrawn, either after a call to chart.redraw() or after an axis, series or point is modified with the redraw option set to true. The this keyword refers to the chart object itself. One parameter, event, is passed to the function. selection: null // Fires when an area of the chart has been selected. Selection is enabled by setting the chart's zoomType. The this keyword refers to the chart object itself. One parameter, event, is passed to the function. }, height: null, // An explicit height for the chart. By default the height is calculated from the offset height of the containing element, or 400 pixels if the containing element's height is 0. ignoreHiddenSeries: true, // If true, the axes will scale to the remaining visible series once one series is hidden. inverted: false, // Whether to invert the axes so that the x axis is vertical and y axis is horizontal. When true, the x axis is reversed by default. If a bar series is present in the chart, it will be inverted automatically. margin: [null], // The margin between the outer edge of the chart and the plot area. The numbers in the array designate top, right, bottom and left respectively. Use the options marginTop, marginRight, marginBottom and marginLeft for shorthand setting of one option. marginBottom: null, // The margin between the bottom outer edge of the chart and the plot area. Use this to set a fixed pixel value for the margin as opposed to the default dynamic margin. marginLeft: null, // The margin between the left outer edge of the chart and the plot area. Use this to set a fixed pixel value for the margin as opposed to the default dynamic margin. marginRight: null, // The margin between the right outer edge of the chart and the plot area. Use this to set a fixed pixel value for the margin as opposed to the default dynamic margin. marginTop: null, // The margin between the top outer edge of the chart and the plot area. Use this to set a fixed pixel value for the margin as opposed to the default dynamic margin. options3d: { alpha: 0, // One of the two rotation angles for the chart. beta: 0, // One of the two rotation angles for the chart. depth: 100, // The total depth of the chart. enabled: false, // Wether to render the chart using the 3D functionality. frame: { back: { color: transparent, // The color of the panel. size: 1 // Thickness of the panel. }, bottom: { color: transparent, // The color of the panel. size: 1 // Thickness of the panel. }, side: { color: transparent, // The color of the panel. size: 1 // Thickness of the panel. } }, viewDistance: 100 // Defines the distance the viewer is standing in front of the chart, this setting is important to calculate the perspective effect in column and scatter charts. It is not used for 3D pie charts. }, pinchType: null, // Equivalent to zoomType, but for multitouch gestures only. By default, the pinchType is the same as the zoomType setting. plotBackgroundColor: null, // The background color or gradient for the plot area. plotBackgroundImage: null, // The URL for an image to use as the plot background. plotBorderColor: '#C0C0C0', // The color of the inner chart or plot area border. plotBorderWidth: 0, // The pixel width of the plot area border. plotShadow: false, // Whether to apply a drop shadow to the plot area. polar: false, // When true, cartesian charts like line, spline, area and column are transformed into the polar coordinate system. reflow: true, // Whether to reflow the chart to fit the width of the container div on resizing the window. renderTo: null, // The HTML element where the chart will be rendered. If it is a string, the element by that id is used. The HTML element can also be passed by direct reference. resetZoomButton: { position: null, // The position of the button. This is an object that can hold the properties align, verticalAlign, x and y. relativeTo: 'plot', // What frame the button should be placed related to. Can be either "plot" or "chart". theme: null // A collection of attributes for the button. The object takes SVG attributes like fill, stroke, stroke-width or r, the border radius. }, selectionMarkerFill: rgba(69,114,167,0.25), // The background color of the marker square when selecting (zooming in on) an area of the chart. shadow: false, // Whether to apply a drop shadow to the outer chart area. Requires that backgroundColor be set. Since 2.3 the shadow can be an object configuration containing color, offsetX, offsetY, opacity and width. showAxes: false, // Whether to show the axes initially. This only applies to empty charts where series are added dynamically, as axes are automatically added to cartesian series. spacing: [10, 10, 15, 10], // The distance between the outer edge of the chart and the content, like title, legend, axis title or labels. The numbers in the array designate top, right, bottom and left respectively. spacingBottom: 15, // The space between the bottom edge of the chart and the content (plot area, axis title and labels, title, subtitle or legend in top position). spacingLeft: 10, // The space between the left edge of the chart and the content (plot area, axis title and labels, title, subtitle or legend in top position). spacingRight: 10, // The space between the right edge of the chart and the content (plot area, axis title and labels, title, subtitle or legend in top position). spacingTop: 10, // The space between the top edge of the chart and the content (plot area, axis title and labels, title, subtitle or legend in top position). style: null, // Additional CSS styles to apply inline to the container div. Note that since the default font styles are applied in the renderer, it is ignorant of the individual chart options and must be set globally. type: 'line', // The default series type for the chart. Can be any of the chart types listed under plotOptions. width: null, // An explicit width for the chart. By default the width is calculated from the offset width of the containing element. zoomType: null, // Decides in what dimentions the user can zoom by dragging the mouse. Can be one of x, y or xy. }, colors: ['#7cb5ec', '#434348', '#90ed7d', '#f7a35c', '#8085e9', '#f15c80', '#e4d354', '#8085e8', '#8d4653', '#91e8e1'], // An array containing the default colors for the chart's series. When all colors are used, new colors are pulled from the start again. credits: { enabled: true, // Whether to show the credits text. href: 'http://www.highcharts.com', // The URL for the credits label. position: null, // Position configuration for the credtis label. style: null, // CSS styles for the credits label. text: 'Highcharts.com.' // The text for the credits label. }, drilldown: { activeAxisLabelStyle: null, // Additional styles to apply to the X axis label for a point that has drilldown data. activeDataLabelStyle: null, // Additional styles to apply to the data label of a point that has drilldown data. animation: null, // Set the animation for all drilldown animations. Animation of a drilldown occurs when drilling between a column point and a column series, or a pie slice and a full pie series. drillUpButton: { position: null, // Positioning options for the button within the relativeTo box. Available properties are x, y, align and verticalAlign. relativeTo: 'plotBox', // What box to align the button to. Can be either "plotBox" or "spacingBox". theme: null // A collection of attributes for the button. The object takes SVG attributes like fill, stroke, stroke-width or r, the border radius. }, series: null // An array of series configurations for the drill down. Each series configuration uses the same syntax as the series option set. }, exporting: { buttons: { contextButton: { align: 'right', // Alignment for the buttons. enabled: true, // Whether to enable buttons. height: 20, // Pixel height of the buttons. menuItems: null, // A collection of config options for the menu items. Each options object consists of a text option which is a string to show in the menu item, as well as an onclick parameter which is a callback function to run on click. onclick: null, // A click handler callback to use on the button directly instead of the popup menu. symbol: 'menu', // The symbol for the button. Points to a definition function in the Highcharts.Renderer.symbols collection. The default exportIcon function is part of the exporting module. symbolFill: '#A8BF77', // See navigation.buttonOptions => symbolFill. symbolSize: 14, // The pixel size of the symbol on the button. symbolStroke: 14, // The color of the symbol's stroke or line. symbolStrokeWidth: 1, // The pixel stroke width of the symbol on the button. symbolX: 12.5, // The x position of the center of the symbol inside the button. symbolY: 10.5, // The y position of the center of the symbol inside the button. text: null, // A text string to add to the individual button. theme: null, // A configuration object for the button theme. The object accepts SVG properties like stroke-width, stroke and fill. verticalAlign: 'top', // The vertical alignment of the buttons. Can be one of "top", "middle" or "bottom". width: 24, // The pixel width of the button. x: -10, // The horizontal positioin of the button relative to the align option. y: 0 // The vertical offset of the button's position relative to its verticalAlign. } }, chartOptions: null, // Additional chart options to be merged into an exported chart. For example, the exported chart can be given a specific width and height, or a printer-friendly color scheme. enabled: true, // Whether to enable the exporting module. Disabling the module will hide the context button, but API methods will still be available. filename: 'chart', // The filename, without extension, to use for the exported chart. formAttributes: null, // An object containing additional attributes for the POST form that sends the SVG to the export server. scale: 2, // Defines the scale or zoom factor for the exported image compared to the on-screen display. sourceHeight: null, // Analogous to sourceWidth sourceWidth: null, // The width of the original chart when exported, unless an explicit chart.width is set. The width exported raster image is then multiplied by scale. type: 'image/png', // Default MIME type for exporting if chart.exportChart() is called without specifying a type option. Possible values are image/png, image/jpeg, application/pdf and image/svg+xml. url: 'http://export.highcharts.com', // The URL for the server module converting the SVG string to an image format. By default this points to Highslide Software's free web service. width: undefined, // The pixel width of charts exported to PNG or JPG. As of Highcharts 3.0, the default pixel width is a function of the chart.width or exporting.sourceWidth and the exporting.scale. }, labels: { items: { html: null, // Inner HTML or text for the label. style: null // CSS styles for each label. }, style: null // Shared CSS styles for all labels. }, legend: { align: 'center', // The horizontal alignment of the legend box within the chart area. Valid values are "left", "center" and "right". backgroundColor: null, // The background color of the legend, filling the rounded corner border. borderColor: '#909090', // The color of the drawn border around the legend. borderRadius: 0, // The border corner radius of the legend. borderWidth: 0, // The width of the drawn border around the legend. enabled: true, // Enable or disable the legend. floating: false, // When the legend is floating, the plot area ignores it and is allowed to be placed below it. itemDistance: 20, // In a legend with horizontal layout, the itemDistance defines the pixel distance between each item. itemHiddenStyle: null, // CSS styles for each legend item when the corresponding series or point is hidden. Only a subset of CSS is supported, notably those options related to text. Properties are inherited from style unless overridden here. itemHoverStyle: null, // CSS styles for each legend item in hover mode. Only a subset of CSS is supported, notably those options related to text. Properties are inherited from style unless overridden here. itemMarginBottom: 0, // The pixel bottom margin for each legend item. itemMarginTop: 0, // The pixel top margin for each legend item. itemStyle: { "color": "#333333", "cursor": "pointer", "fontSize": "12px", "fontWeight": "bold" }, // CSS styles for each legend item. Only a subset of CSS is supported, notably those options related to text. itemWidth: null, // The width for each legend item. This is useful in a horizontal layout with many items when you want the items to align vertically. labelFormat: '{name}', // A format string for each legend label. Available variables relates to properties on the series, or the point in case of pies. labelFormatter: null, // Callback function to format each of the series' labels. The this keyword refers to the series object, or the point object in case of pie charts. layout: 'horizontal', // The layout of the legend items. Can be one of "horizontal" or "vertical". lineHeight: 16, // Line height for the legend items. Deprecated as of 2.1. Instead, the line height for each item can be set using itemStyle.lineHeight, and the padding between items using itemMarginTop and itemMarginBottom. margin: 15, // If the plot area sized is calculated automatically and the legend is not floating, the legend margin is the space between the legend and the axis labels or plot area. maxHeight: null, // Maximum pixel height for the legend. When the maximum height is extended, navigation will show. navigation: { activeColor: '#3E576F', // The color for the active up or down arrow in the legend page navigation. animation: true, // How to animate the pages when navigating up or down. A value of true applies the default navigation given in the chart.animation option. Additional options can be given as an object containing values for easing and duration. arrowSize: 12, // The pixel size of the up and down arrows in the legend paging navigation. inactiveColor: '#CCC', // The color of the inactive up or down arrow in the legend page navigation. style: null // Text styles for the legend page navigation. }, padding: 8, // The inner padding of the legend box. reversed: false, // Whether to reverse the order of the legend items compared to the order of the series or points as defined in the configuration object. rtl: false, // Whether to show the symbol on the right side of the text rather than the left side. This is common in Arabic and Hebraic. shadow: false, // Whether to apply a drop shadow to the legend. A backgroundColor also needs to be applied for this to take effect. Since 2.3 the shadow can be an object configuration containing color, offsetX, offsetY, opacity and width. symbolHeight: 12, // The pixel height of the symbol for series types that use a rectangle in the legend. symbolPadding: 5, // The pixel padding between the legend item symbol and the legend item text. symbolRadius: 2, // The border radius of the symbol for series types that use a rectangle in the legend. symbolWidth: 16, // The pixel width of the legend item symbol. title: { style: null, // Generic CSS styles for the legend title. text: null // A text or HTML string for the title. }, useHTML: false, // Whether to use HTML to render the legend item texts. When using HTML, legend.navigation is disabled. verticalAlign: 'bottom', // The vertical alignment of the legend box. Can be one of "top", "middle" or "bottom". Vertical position can be further determined by the y option. width: null, // The width of the legend box. x: 0, // The x offset of the legend relative to it's horizontal alignment align within chart.spacingLeft and chart.spacingRight. Negative x moves it to the left, positive x moves it to the right. y: 0 // The vertical offset of the legend relative to it's vertical alignment verticalAlign within chart.spacingTop and chart.spacingBottom. Negative y moves it up, positive y moves it down. }, loading: { hideDuration: 100, // The duration in milliseconds of the fade out effect. labelStyle: null, // CSS styles for the loading label span. showDuration: 100, // The duration in milliseconds of the fade in effect. style: null // CSS styles for the loading screen that covers the plot area. }, navigation: { buttonOptions: { align: 'right', // Alignment for the buttons. enabled: true, // Whether to enable buttons. height: 20, // Pixel height of the buttons. symbolFill: '#E0E0E0', // Fill color for the symbol within the button. symbolSize: 14, // The pixel size of the symbol on the button. symbolStroke: '#666', // The color of the symbol's stroke or line. symbolStrokeWidth: 1, // The pixel stroke width of the symbol on the button. symbolX: 12.5, // The x position of the center of the symbol inside the button. symbolY: 10.5, // The y position of the center of the symbol inside the button. text: null, // A text string to add to the individual button. theme: null, // A configuration object for the button theme. The object accepts SVG properties like stroke-width, stroke and fill. Tri-state button styles are supported by the states.hover and states.select objects. verticalAlign: 'top', // The vertical alignment of the buttons. Can be one of "top", "middle" or "bottom". width: 24, // The pixel width of the button. y: 0 // The vertical offset of the button's position relative to its verticalAlign. }, menuItemHoverStyle: null, // CSS styles for the hover state of the individual items within the popup menu appearing by default when the export icon is clicked. The menu items are rendered in HTML. menuItemStyle: null, // CSS styles for the individual items within the popup menu appearing by default when the export icon is clicked. The menu items are rendered in HTML. menuStyle: null // CSS styles for the popup menu appearing by default when the export icon is clicked. This menu is rendered in HTML. }, noData: { attr: null, // An object of additional SVG attributes for the no-data label. position: { 'x': 0, 'y': 0, 'align': 'center', 'verticalAlign': 'middle' }, // The position of the no-data label, relative to the plot area. style: { "fontSize": "12px", "fontWeight": "bold", "color": "#60606a" } // CSS styles for the no-data label. }, pane: { background: null, // An object, or array of objects, for backgrounds. Sub options include backgroundColor (can be solid or gradient), shape ("solid" or "arc"), innerWidth, outerWidth, borderWidth, borderColor. center: ['50%', '50%'], // The center of a polar chart or angular gauge, given as an array of [x, y] positions. Positions can be given as integers that transform to pixels, or as percentages of the plot area size. endAngle: null, // The end angle of the polar X axis or gauge value axis, given in degrees where 0 is north. startAngle: null // The start angle of the polar X axis or gauge axis, given in degrees where 0 is north. }, plotOptions: { // area, arearange, areaspline, areasplinerange, bar, boxplot, bubble, column, columnrange, errorbar, funnel, gauge, heatmap, line, pie, pyramid, scatter, series, solidgauge, spline, waterfall area: { allowPointSelect: false, // Allow this series' points to be selected by clicking on the markers, bars or pie slices. animation: true, // Enable or disable the initial animation when a series is displayed. The animation can also be set as a configuration object. Please note that this option only applies to the initial animation of the series itself. For other animations, see chart.animation and the animation parameter under the API methods. color: null, // The main color or the series. In line type series it applies to the line and the point markers unless otherwise specified. In bar type series it applies to the bars unless a color is specified per point. The default value is pulled from the options.colors array. connectEnds: true, // Polar charts only. Whether to connect the ends of a line series plot across the extremes. connectNulls: false, // Whether to connect a graph line across null points. cropThreshold: 300, // When the series contains less points than the crop threshold, all points are drawn, event if the points fall outside the visible plot area at the current zoom. The advantage of drawing all points (including markers and columns), is that animation is performed on updates. cursor: null, // You can set the cursor to "pointer" if you have click events attached to the series, to signal to the user that the points and lines can be clicked. dashStyle: 'Solid', //