Overview
An interactive candlestick chart.
A candlestick chart is used to show an opening and closing value overlaid on top of a total variance. Candlestick charts are often used to show stock value behavior. In this chart, items where the opening value is less than the closing value (a gain) are drawn as filled boxes, and items where the opening value is more than the closing value (a loss) are drawn as hollow boxes.
Example
<html>
<head>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Mon', 20, 28, 38, 45],
['Tue', 31, 38, 55, 66],
['Wed', 50, 55, 77, 80],
['Thu', 77, 77, 66, 50],
['Fri', 68, 66, 22, 15]
// Treat first row as data as well.
], true);
var options = {
legend:'none'
};
var chart = new google.visualization.CandlestickChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="chart_div" style="width: 900px; height: 500px;"></div>
</body>
</html>
Waterfall charts
With the right set of options, candlestick charts can be made to resemble simple waterfall charts.
In the code below, we're eliminating the top wicks by having the same values in the first and second columns, and the bottom wicks by having the same values in the third and fourth columns. We set bar.groupWidth
to '100%'
to remove the space between the bars.
<html>
<head>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Mon', 28, 28, 38, 38],
['Tue', 38, 38, 55, 55],
['Wed', 55, 55, 77, 77],
['Thu', 77, 77, 66, 66],
['Fri', 66, 66, 22, 22]
// Treat the first row as data.
], true);
var options = {
legend: 'none',
bar: { groupWidth: '100%' }, // Remove space between bars.
candlestick: {
fallingColor: { strokeWidth: 0, fill: '#a52714' }, // red
risingColor: { strokeWidth: 0, fill: '#0f9d58' } // green
}
};
var chart = new google.visualization.CandlestickChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="chart_div" style="width: 900px; height: 500px;"></div>
</body>
</html>
There is currently no easy way to label the bars. The best option is to use overlays.
Loading
google.charts.load
package name is "corechart"
.
google.charts.load('current', {packages: ['corechart']});
The visualization's class name is google.visualization.
CandlestickChart.
var visualization = new google.visualization.CandlestickChart(container);
Data format
Five or more columns, where the first column defines X-axis values or group labels, and each multiple of four data columns after that defines a different series.
- Col 0: String (discrete) used as a group label on the X axis, or number, date, datetime, or timeofday (continuous) used as a value on the X axis.
- Col 1: Number specifying the low/minimum value of this marker. This is the base of the candle's center line. The column label is used as the series label in the legend (while the labels of the other columns are ignored).
- Col 2: Number specifying the opening/initial value of this marker. This is one vertical border of the candle. If less than the column 3 value, the candle will be filled; otherwise it will be hollow.
- Col 3: Number specifying the closing/final value of this marker. This is the second vertical border of the candle. If less than the column 2 value, the candle will be hollow; otherwise it will be filled.
- Col 4: Number specifying the high/maximum value of this marker. This is the top of the candle's center line.
- Col 5 [Optional]: A tooltip or style column for the candlestick.
In order to have more series, it is possible to add additional sets of 4 columns, with a similar structure to columns 1-4. Each such set represents another series of candlesticks. The total number of columns should be 4 times the number of series plus 1 (and any optional tooltip columns).
Configuration options
Name | |
---|---|
aggregationTarget | How multiple data selections are rolled up into tooltips:
aggregationTarget will often be used in tandem with selectionMode and tooltip.trigger , e.g.:var options = { Type: string Default: 'auto' |
animation.duration | The duration of the animation, in milliseconds. For details, see the animation documentation. Type: number Default: 0 |
animation.easing | The easing function applied to the animation. The following options are available:
Type: string Default: 'linear' |
animation.startup | Determines if the chart will animate on the initial draw. If Type: boolean Default false |
axisTitlesPosition | Where to place the axis titles, compared to the chart area. Supported values:
Type: string Default: 'out' |
backgroundColor | The background color for the main area of the chart. Can be either a simple HTML color string, for example: Type: string or object Default: 'white' |
backgroundColor.stroke | The color of the chart border, as an HTML color string. Type: string Default: '#666' |
backgroundColor.strokeWidth | The border width, in pixels. Type: number Default: 0 |
backgroundColor.fill | The chart fill color, as an HTML color string. Type: string Default: 'white' |
bar.groupWidth | The width of a group of candlesticks, specified in either of these formats:
Type: number or string Default: The golden ratio, approximately '61.8%'. |
candlestick.hollowIsRising | If true, rising candles will appear hollow and falling candles will appear solid, otherwise, the opposite. Type: boolean Default: false (will later be changed to true) |
candlestick.fallingColor.fill | The fill color of falling candles, as an HTML color string. Type: string Default: auto (depends on the series color and hollowIsRising) |
candlestick.fallingColor.stroke | The stroke color of falling candles, as an HTML color string. Type: string Default: auto (the series color) |
candlestick.fallingColor.strokeWidth | The stroke width of falling candles, as an HTML color string. Type: 2 Default: number |
candlestick.risingColor.fill | The fill color of rising candles, as an HTML color string. Type: string Default: auto (white or the series color, depending on hollowIsRising) |
candlestick.risingColor.stroke | The stroke color of rising candles, as an HTML color string. Type: string Default: auto (the series color or white, depending on hollowIsRising) |
candlestick.risingColor.strokeWidth | The stroke width of rising candles, as an HTML color string. Type: number Default: 2 |
chartArea | An object with members to configure the placement and size of the chart area (where the chart itself is drawn, excluding axis and legends). Two formats are supported: a number, or a number followed by %. A simple number is a value in pixels; a number followed by % is a percentage. Example: Type: object Default: null |
chartArea.backgroundColor | Chart area background color. When a string is used, it can be either a hex string (e.g., '#fdc') or an English color name. When an object is used, the following properties can be provided:
Type: string or object Default: 'white' |
chartArea.left | How far to draw the chart from the left border. Type: number or string Default: auto |
chartArea.top | How far to draw the chart from the top border. Type: number or string Default: auto |
chartArea.width | Chart area width. Type: number or string Default: auto |
chartArea.height | Chart area height. Type: number or string Default: auto |
colors | The colors to use for the chart elements. An array of strings, where each element is an HTML color string, for example: Type: Array of strings Default: default colors |
enableInteractivity | Whether the chart throws user-based events or reacts to user interaction. If false, the chart will not throw 'select' or other interaction-based events (but will throw ready or error events), and will not display hovertext or otherwise change depending on user input. Type: boolean Default: true |
focusTarget | The type of the entity that receives focus on mouse hover. Also affects which entity is selected by mouse click, and which data table element is associated with events. Can be one of the following:
In focusTarget 'category' the tooltip displays all the category values. This may be useful for comparing values of different series. Type: string Default: 'datum' |
fontSize | The default font size, in pixels, of all text in the chart. You can override this using properties for specific chart elements. Type: number Default: automatic |
fontName | The default font face for all text in the chart. You can override this using properties for specific chart elements. Type: string Default: 'Arial' |
forceIFrame | Draws the chart inside an inline frame. (Note that on IE8, this option is ignored; all IE8 charts are drawn in i-frames.) Type: boolean Default: false |
hAxis | An object with members to configure various horizontal axis elements. To specify properties of this object, you can use object literal notation, as shown here: { title: 'Hello', titleTextStyle: { color: '#FF0000' } } Type: object Default: null |
hAxis.baseline | The baseline for the horizontal axis. This option is only supported for a Type: number Default: automatic |
hAxis.baselineColor | The color of the baseline for the horizontal axis. Can be any HTML color string, for example: This option is only supported for a Type: number Default: 'black' |
hAxis.direction | The direction in which the values along the horizontal axis grow. Specify Type: 1 or -1 Default: 1 |
hAxis.format | A format string for numeric or date axis labels. For number axis labels, this is a subset of the decimal formatting ICU pattern set . For instance,
For date axis labels, this is a subset of the date formatting ICU pattern set . For instance, The actual formatting applied to the label is derived from the locale the API has been loaded with. For more details, see loading charts with a specific locale . This option is only supported for a Type: string Default: auto |
hAxis.gridlines | An object with members to configure the gridlines on the horizontal axis. To specify properties of this object, you can use object literal notation, as shown here: {color: '#333', count: 4} This option is only supported for a Type: object Default: null |
hAxis.gridlines.color | The color of the horizontal gridlines inside the chart area. Specify a valid HTML color string. Type: string Default: '#CCC' |
hAxis.gridlines.count | The number of horizontal gridlines inside the chart area. Minimum value is 2. Specify -1 to automatically compute the number of gridlines. Type: number Default: 5 |
hAxis.gridlines.units | Overrides the default format for various aspects of date/datetime/timeofday data types when used with chart computed gridlines. Allows formatting for years, months, days, hours, minutes, seconds, and milliseconds. General format is: gridlines: { units: { years: {format: [/*format strings here*/]}, months: {format: [/*format strings here*/]}, days: {format: [/*format strings here*/]} hours: {format: [/*format strings here*/]} minutes: {format: [/*format strings here*/]} seconds: {format: [/*format strings here*/]}, milliseconds: {format: [/*format strings here*/]}, } } Additional information can be found in Dates and Times. Type: object Default: null |
hAxis.minorGridlines | An object with members to configure the minor gridlines on the horizontal axis, similar to the hAxis.gridlines option. This option is only supported for a Type: object Default: null |
hAxis.minorGridlines.color | The color of the horizontal minor gridlines inside the chart area. Specify a valid HTML color string. Type: string Default: A blend of the gridline and background colors |
hAxis.minorGridlines.count | The number of horizontal minor gridlines between two regular gridlines. Type: number Default: 0 |
hAxis.minorGridlines.units | Overrides the default format for various aspects of date/datetime/timeofday data types when used with chart computed minorGridlines. Allows formatting for years, months, days, hours, minutes, seconds, and milliseconds. General format is: gridlines: { units: { years: {format: [/*format strings here*/]}, months: {format: [/*format strings here*/]}, days: {format: [/*format strings here*/]} hours: {format: [/*format strings here*/]} minutes: {format: [/*format strings here*/]} seconds: {format: [/*format strings here*/]}, milliseconds: {format: [/*format strings here*/]}, } } Additional information can be found in Dates and Times. Type: object Default: null |
hAxis.logScale |
This option is only supported for a Type: boolean Default: false |
hAxis.scaleType |
This option is only supported for a Type: string Default: null |
hAxis.textPosition | Position of the horizontal axis text, relative to the chart area. Supported values: 'out', 'in', 'none'. Type: string Default: 'out' |
hAxis.textStyle | An object that specifies the horizontal axis text style. The object has this format: { color: <string>, fontName: <string>, fontSize: <number>, bold: <boolean>, italic: <boolean> } The Type: object Default: {color: 'black', fontName: <global-font-name>, fontSize: <global-font-size>} |
hAxis.ticks | Replaces the automatically generated X-axis ticks with the specified array. Each element of the array should be either a valid tick value (such as a number, date, datetime, or timeofday), or an object. If it's an object, it should have a Examples:
This option is only supported for a Type: Array of elements Default: auto |
hAxis.title |
Type: string Default: null |
hAxis.titleTextStyle | An object that specifies the horizontal axis title text style. The object has this format: { color: <string>, fontName: <string>, fontSize: <number>, bold: <boolean>, italic: <boolean> } The Type: object Default: {color: 'black', fontName: <global-font-name>, fontSize: <global-font-size>} |
hAxis.allowContainerBoundaryTextCufoff | If false, will hide outermost labels rather than allow them to be cropped by the chart container. If true, will allow label cropping. This option is only supported for a Type: boolean Default: false |
hAxis.slantedText | If true, draw the horizontal axis text at an angle, to help fit more text along the axis; if false, draw horizontal axis text upright. Default behavior is to slant text if it cannot all fit when drawn upright. Notice that this option is available only when the This option is only supported for a Type: boolean Default: automatic |
hAxis.slantedTextAngle | The angle of the horizontal axis text, if it's drawn slanted. Ignored if This option is only supported for a Type: number, 1—90 Default: 30 |
hAxis.maxAlternation | Maximum number of levels of horizontal axis text. If axis text labels become too crowded, the server might shift neighboring labels up or down in order to fit labels closer together. This value specifies the most number of levels to use; the server can use fewer levels, if labels can fit without overlapping. This option is only supported for a Type: number Default: 2 |
hAxis.maxTextLines | Maximum number of lines allowed for the text labels. Labels can span multiple lines if they are too long, and the number of lines is, by default, limited by the height of the available space. This option is only supported for a Type: number Default: auto |
hAxis.minTextSpacing | Minimum horizontal spacing, in pixels, allowed between two adjacent text labels. If the labels are spaced too densely, or they are too long, the spacing can drop below this threshold, and in this case one of the label-unclutter measures will be applied (e.g, truncating the lables or dropping some of them). This option is only supported for a Type: number Default: The value of hAxis.textStyle.fontSize |
hAxis.showTextEvery | How many horizontal axis labels to show, where 1 means show every label, 2 means show every other label, and so on. Default is to try to show as many labels as possible without overlapping. This option is only supported for a Type: number Default: automatic |
hAxis.maxValue | Moves the max value of the horizontal axis to the specified value; this will be rightward in most charts. Ignored if this is set to a value smaller than the maximum x-value of the data. This option is only supported for a Type: number Default: automatic |
hAxis.minValue | Moves the min value of the horizontal axis to the specified value; this will be leftward in most charts. Ignored if this is set to a value greater than the minimum x-value of the data. This option is only supported for a Type: number Default: automatic |
hAxis.viewWindowMode | Specifies how to scale the horizontal axis to render the values within the chart area. The following string values are supported:
This option is only supported for a Type: string Default: Equivalent to 'pretty', but haxis.viewWindow.min andhaxis.viewWindow.max take precedence if used. |
hAxis.viewWindow | Specifies the cropping range of the horizontal axis. Type: object Default: null |
hAxis.viewWindow.max |
Ignored when Type: number Default: auto |
hAxis.viewWindow.min |
Ignored when Type: number Default: auto |
height | Height of the chart, in pixels. Type: number Default: height of the containing element |
legend | An object with members to configure various aspects of the legend. To specify properties of this object, you can use object literal notation, as shown here: {position: 'top', textStyle: {color: 'blue', fontSize: 16}} Type: object Default: null |
legend.alignment | Alignment of the legend. Can be one of the following:
Start, center, and end are relative to the style -- vertical or horizontal -- of the legend. For example, in a 'right' legend, 'start' and 'end' are at the top and bottom, respectively; for a 'top' legend, 'start' and 'end' would be at the left and right of the area, respectively. The default value depends on the legend's position. For 'bottom' legends, the default is 'center'; other legends default to 'start'. Type: string Default: automatic |
legend.maxLines | Maximum number of lines in the legend. Set this to a number greater than one to add lines to your legend. Note: The exact logic used to determine the actual number of lines rendered is still in flux. This option currently works only when legend.position is 'top'. Type: number Default: 1 |
legend.position | Position of the legend. Can be one of the following:
Type: string Default: 'right' |
legend.textStyle | An object that specifies the legend text style. The object has this format: { color: <string>, fontName: <string>, fontSize: <number>, bold: <boolean>, italic: <boolean> } The Type: object Default: {color: 'black', fontName: <global-font-name>, fontSize: <global-font-size>} |
orientation | The orientation of the chart. When set to Type: string Default: 'horizontal' |
reverseCategories | If set to true, will draw series from right to left. The default is to draw left-to-right. This option is only supported for a Type: boolean Default: false |
selectionMode | When Type: string Default: 'single' |
series | An array of objects, each describing the format of the corresponding series in the chart. To use default values for a series, specify an empty object {}. If a series or a value is not specified, the global value will be used. Each object supports the following properties:
You can specify either an array of objects, each of which applies to the series in the order given, or you can specify an object where each child has a numeric key indicating which series it applies to. For example, the following two declarations are identical, and declare the first series as black and absent from the legend, and the fourth as red and absent from the legend: series: [ {color: 'black', visibleInLegend: false}, {}, {}, {color: 'red', visibleInLegend: false} ] series: { 0:{color: 'black', visibleInLegend: false}, 3:{color: 'red', visibleInLegend: false} } Type: Array of objects, or object with nested objects Default: {} |
theme | A theme is a set of predefined option values that work together to achieve a specific chart behavior or visual effect. Currently only one theme is available:
Type: string Default: null |
title | Text to display above the chart. Type: string Default: no title |
titlePosition | Where to place the chart title, compared to the chart area. Supported values:
Type: string Default: 'out' |
titleTextStyle | An object that specifies the title text style. The object has this format: { color: <string>, fontName: <string>, fontSize: <number>, bold: <boolean>, italic: <boolean> } The Type: object Default: {color: 'black', fontName: <global-font-name>, fontSize: <global-font-size>} |
tooltip | An object with members to configure various tooltip elements. To specify properties of this object, you can use object literal notation, as shown here: {textStyle: {color: '#FF0000'}, showColorCode: true} Type: object Default: null |
tooltip.ignoreBounds | If set to Note: This only applies to HTML tooltips. If this is enabled with SVG tooltips, any overflow outside of the chart bounds will be cropped. See Customizing Tooltip Content for more details. Type: boolean Default: false |
tooltip.isHtml | If set to true, use HTML-rendered (rather than SVG-rendered) tooltips. See Customizing Tooltip Content for more details. Note: customization of the HTML tooltip content via the tooltip column data role is not supported by the Bubble Chart visualization. Type: boolean Default: false |
tooltip.showColorCode | If true, show colored squares next to the series information in the tooltip. The default is true when Type: boolean Default: automatic |
tooltip.textStyle | An object that specifies the tooltip text style. The object has this format: { color: <string>, fontName: <string>, fontSize: <number>, bold: <boolean>, italic: <boolean> } The Type: object Default: {color: 'black', fontName: <global-font-name>, fontSize: <global-font-size>} |
tooltip.trigger | The user interaction that causes the tooltip to be displayed:
Type: string Default: 'focus' |
vAxes | Specifies properties for individual vertical axes, if the chart has multiple vertical axes. Each child object is a To specify a chart with multiple vertical axes, first define a new axis using { series: { 2: { targetAxisIndex:1 } }, vAxes: { 1: { title:'Losses', textStyle: {color: 'red'} } } } This property can be either an object or an array: the object is a collection of objects, each with a numeric label that specifies the axis that it defines--this is the format shown above; the array is an array of objects, one per axis. For example, the following array-style notation is identical to the vAxes: [ {}, // Nothing specified for axis 0 { title:'Losses', textStyle: {color: 'red'} // Axis 1 } ] Type: Array of object, or object with child objects Default: null |
vAxis | An object with members to configure various vertical axis elements. To specify properties of this object, you can use object literal notation, as shown here: {title: 'Hello', titleTextStyle: {color: '#FF0000'}} Type: object Default: null |
vAxis.baseline |
Type: number Default: automatic |
vAxis.baselineColor | Specifies the color of the baseline for the vertical axis. Can be any HTML color string, for example: Type: number Default: 'black' |
vAxis.direction | The direction in which the values along the vertical axis grow. Specify Type: 1 or -1 Default: 1 |
vAxis.format | A format string for numeric axis labels. This is a subset of the ICU pattern set . For instance,
The actual formatting applied to the label is derived from the locale the API has been loaded with. For more details, see loading charts with a specific locale . Type: string Default: auto |
vAxis.gridlines | An object with members to configure the gridlines on the vertical axis. To specify properties of this object, you can use object literal notation, as shown here: {color: '#333', count: 4} Type: object Default: null |
vAxis.gridlines.color | The color of the vertical gridlines inside the chart area. Specify a valid HTML color string. Type: string Default: '#CCC' |
vAxis.gridlines.count | The number of vertical gridlines inside the chart area. Minimum value is 2. Specify -1 to automatically compute the number of gridlines. Type: number Default: 5 |
vAxis.gridlines.units | Overrides the default format for various aspects of date/datetime/timeofday data types when used with chart computed gridlines. Allows formatting for years, months, days, hours, minutes, seconds, and milliseconds. General format is: gridlines: { units: { years: {format: [/*format strings here*/]}, months: {format: [/*format strings here*/]}, days: {format: [/*format strings here*/]} hours: {format: [/*format strings here*/]} minutes: {format: [/*format strings here*/]} seconds: {format: [/*format strings here*/]}, milliseconds: {format: [/*format strings here*/]}, } } Additional information can be found in Dates and Times. Type: object Default: null |
vAxis.minorGridlines | An object with members to configure the minor gridlines on the vertical axis, similar to the vAxis.gridlines option. Type: object Default: null |
vAxis.minorGridlines.color | The color of the vertical minor gridlines inside the chart area. Specify a valid HTML color string. Type: string Default: A blend of the gridline and background colors |
vAxis.minorGridlines.count | The number of vertical minor gridlines between two regular gridlines. Type: number Default: 0 |
vAxis.minorGridlines.units | Overrides the default format for various aspects of date/datetime/timeofday data types when used with chart computed minorGridlines. Allows formatting for years, months, days, hours, minutes, seconds, and milliseconds. General format is: gridlines: { units: { years: {format: [/*format strings here*/]}, months: {format: [/*format strings here*/]}, days: {format: [/*format strings here*/]} hours: {format: [/*format strings here*/]} minutes: {format: [/*format strings here*/]} seconds: {format: [/*format strings here*/]}, milliseconds: {format: [/*format strings here*/]}, } } Additional information can be found in Dates and Times. Type: object Default: null |
vAxis.logScale | If true, makes the vertical axis a logarithmic scale. Note: All values must be positive. Type: boolean Default: false |
vAxis.scaleType |
This option is only supported for a Type: string Default: null |
vAxis.textPosition | Position of the vertical axis text, relative to the chart area. Supported values: 'out', 'in', 'none'. Type: string Default: 'out' |
vAxis.textStyle | An object that specifies the vertical axis text style. The object has this format: { color: <string>, fontName: <string>, fontSize: <number>, bold: <boolean>, italic: <boolean> } The Type: object Default: {color: 'black', fontName: <global-font-name>, fontSize: <global-font-size>} |
vAxis.ticks | Replaces the automatically generated Y-axis ticks with the specified array. Each element of the array should be either a valid tick value (such as a number, date, datetime, or timeofday), or an object. If it's an object, it should have a Examples:
Type: Array of elements Default: auto |
vAxis.title |
Type: string Default: no title |
vAxis.titleTextStyle | An object that specifies the vertical axis title text style. The object has this format: { color: <string>, fontName: <string>, fontSize: <number>, bold: <boolean>, italic: <boolean> } The Type: object Default: {color: 'black', fontName: <global-font-name>, fontSize: <global-font-size>} |
vAxis.maxValue | Moves the max value of the vertical axis to the specified value; this will be upward in most charts. Ignored if this is set to a value smaller than the maximum y-value of the data. Type: number Default: automatic |
vAxis.minValue | Moves the min value of the vertical axis to the specified value; this will be downward in most charts. Ignored if this is set to a value greater than the minimum y-value of the data. Type: number Default: null |
vAxis.viewWindowMode | Specifies how to scale the vertical axis to render the values within the chart area. The following string values are supported:
Type: string Default: Equivalent to 'pretty', but vaxis.viewWindow.min andvaxis.viewWindow.max take precedence if used. |
vAxis.viewWindow | Specifies the cropping range of the vertical axis. Type: object Default: null |
vAxis.viewWindow.max | The maximum vertical data value to render. Ignored when Type: number Default: auto |
vAxis.viewWindow.min | The minimum horizontal data value to render. Ignored when Type: number Default: auto |
width | Width of the chart, in pixels. Type: number Default: width of the containing element |
Methods
Method | |
---|---|
draw( | Draws the chart. The chart accepts further method calls only after the Return Type: none |
getAction( | Returns the tooltip action object with the requested Return Type: object |
getBoundingBox( | Returns an object containing the left, top, width, and height of chart element
Values are relative to the container of the chart. Call this after the chart is drawn. Return Type: object |
getChartAreaBoundingBox() | Returns an object containing the left, top, width, and height of the chart content (i.e., excluding labels and legend):
Values are relative to the container of the chart. Call this after the chart is drawn. Return Type: object |
getChartLayoutInterface() | Returns an object containing information about the onscreen placement of the chart and its elements. The following methods can be called on the returned object:
Call this after the chart is drawn. Return Type: object |
getHAxisValue( | Returns the logical horizontal value at Example: Call this after the chart is drawn. Return Type: number |
getImageURI() | Returns the chart serialized as an image URI. Call this after the chart is drawn. See Printing PNG Charts. Return Type: string |
getSelection() | Returns an array of the selected chart entities. Selectable entities are candlesticks, legend entries and categories. For this chart, only one entity can be selected at any given moment. Return Type: Array of selection elements |
getVAxisValue( | Returns the logical vertical value at Example: Call this after the chart is drawn. Return Type: number |
getXLocation( | Returns the screen x-coordinate of Example: Call this after the chart is drawn. Return Type: number |
getYLocation( | Returns the screen y-coordinate of Example: Call this after the chart is drawn. Return Type: number |
removeAction( | Removes the tooltip action with the requested Return Type: none |
setAction( | Sets a tooltip action to be executed when the user clicks on the action text. The Any and all tooltip actions should be set prior to calling the chart's Return Type: none |
setSelection() | Selects the specified chart entities. Cancels any previous selection. Selectable entities are candlesticks, legend entries and categories. For this chart, only one entity can be selected at a time. Return Type: none |
clearChart() | Clears the chart, and releases all of its allocated resources. Return Type: none |
Events
For more information on how to use these events, see Basic Interactivity, Handling Events, and Firing Events.
Name | |
---|---|
animationfinish | Fired when transition animation is complete. Properties: none |
click | Fired when the user clicks inside the chart. Can be used to identify when the title, data elements, legend entries, axes, gridlines, or labels are clicked. Properties: targetID |
error | Fired when an error occurs when attempting to render the chart. Properties: id, message |
onmouseover | Fired when the user mouses over a visual entity. Passes back the row and column indices of the corresponding data table element. A candlestick correlates to a cell in the data table, a legend entry to a column (row index is null), and a category to a row (column index is null). Properties: row, column |
onmouseout | Fired when the user mouses away from a visual entity. Passes back the row and column indices of the corresponding data table element. A candlestick correlates to a cell in the data table, a legend entry to a column (row index is null), and a category to a row (column index is null). Properties: row, column |
ready | The chart is ready for external method calls. If you want to interact with the chart, and call methods after you draw it, you should set up a listener for this event before you call the Properties: none |
select | Fired when the user clicks a visual entity. To learn what has been selected, call Properties: none |
'WEB' 카테고리의 다른 글
[PHP] Parsing (0) | 2018.02.05 |
---|---|
[PHP] number with comma (0) | 2018.02.05 |
[Google Chart] Google Charts - Basic Candlestick Chart (0) | 2018.01.29 |
[Google Chart] Candle Stick (0) | 2018.01.29 |
[PHP] addslashes (0) | 2018.01.24 |