ローソク足チャート
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
重要: Google グラフツールのイメージグラフのサポートは、2012 年 4 月 20 日をもって正式に終了しました。この機能は非推奨ポリシーに従って引き続き機能します。
概要
Google Charts API を使用して画像としてレンダリングされるローソク足チャート。
ローソク足チャートは、全分散の上に始値と終値を重ねて表示するために使用します。ローソク足チャートは、株価の動きを示すためによく使用されます。このグラフでは、始値が終値より小さい項目は緑色で、始値値が終値より大きい項目は赤色で描画されています。詳しくは、Google Charts API のローソク足に関するドキュメントをご覧ください。
例
<html>
<head>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load("current", {packages:["imagechart"]});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var options = {};
dataTable = google.visualization.arrayToDataTable([
['Gainers',10,30,45,60],
['Losers',20,35,25,45],
], true);
var chart = new google.visualization.ImageCandlestickChart(document.getElementById('chart_div'));
chart.draw(dataTable, options);
}
</script>
</head>
<body>
<div id="chart_div" style="width: 400px; height: 240px;"></div>
</body>
</html>
読み込んでいます
google.charts.load
パッケージ名は "imagechart"
です。
google.charts.load('current', {packages: [imagechart]});
ビジュアリゼーションのクラス名は google.visualization.ImageCandlestickChart
です。
var visualization = new google.visualization.ImageCandlestickChart(container);
5 つの列。各行が 1 つのローソク足マーカーを表します。
- Col 0: X 軸でこのマーカーのラベルとして使用される文字列。
- 列 1: このマーカーの下限値または下限値を指定する数値です。これが黒い線の土台です。
- 列 2: このマーカーの開始値または初期値を指定する数値。ローソク足のボックスの片方の端となります。ローソクが 3 列目の値より小さい場合は緑色、そうでない場合は赤色になります。
- Col 3: このマーカーの終了値(最終値)を指定する数値です。ローソク足のボックスのもう一方の端となります。ローソクが列 2 の値より小さい場合は赤、そうでない場合は緑色になります。
- 列 4: このマーカーの高い値(最大値)を指定する数値。これが黒い線の上部です。
構成オプション
ローソク足チャートでは、汎用イメージ チャートでサポートされているオプションに加えて、次のオプションがサポートされています。
名前 |
タイプ |
デフォルト |
説明 |
backgroundColor |
string |
'#FFFFFF'(白) |
グラフの背景色。これは #記号を含む # RRGGBB 文字列です。 |
showAxisLines |
boolean |
true |
軸線を表示するかどうかを指定します。false に設定すると、軸ラベルも表示されません。 |
身長 |
数値 |
含まれる要素の高さ |
グラフの高さ(ピクセル単位)。30 < height または height > 1,000 の場合、この値はデフォルトで 200 になります。 |
max |
数値 |
データの最大値 |
Y 軸の最大値。 |
分 |
数値 |
データの最小値 |
Y 軸の最小値。 |
showCategoryLabels |
boolean |
true |
false の場合、X 軸のラベルが非表示になります。 |
showValueLabels |
boolean |
true |
false の場合、Y 軸のラベルが非表示になります。 |
showValueLabelsInternal |
数値 |
自動 |
Y 軸のラベルの間隔(ピクセル単位)。 |
title |
string |
'' |
グラフの上部に表示するテキストです。 |
幅 |
数値 |
含まれる要素の幅 |
グラフの幅(ピクセル単位)。width が 30 より小さい場合、または 1,000 より大きい場合、width は 300 に設定されます。 |
メソッド
メソッド |
戻り値の型 |
説明 |
draw(data, options) |
none |
グラフを描画します。 |
イベント
登録すると、汎用イメージグラフのページで説明されているイベントを聞くことができます。
データポリシー
Chart API のロギング ポリシーをご覧ください。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2024-07-10 UTC。
[null,null,["最終更新日 2024-07-10 UTC。"],[],[],null,["# Candlestick Image Chart\n\n**Important:** The Image Charts portion of Google Chart Tools has been [officially deprecated](http://googledevelopers.blogspot.com/2012/04/changes-to-deprecation-policies-and-api.html) as of April 20, 2012. It will continue to work as per our [deprecation policy](/chart/terms). \n1. [Overview](#Overview)\n2. [Example](#Example)\n3. [Loading](#Loading)\n4. [Data Format](#Data_Format)\n5. [Configuration Options](#Configuration_Options)\n6. [Methods](#Methods)\n7. [Events](#Events)\n8. [Data Policy](#Data_Policy)\n\nOverview\n--------\n\n\nA candlestick chart that is rendered as an image using the [Google Charts API](/chart/image/docs/gallery/compound_charts#candlestick_charts).\n\nA 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 are drawn in green, and items where the opening value is more than the closing value are drawn in red. See the [candlestick documentation in the Google Charts API](/chart/image/docs/gallery/compound_charts#candlestick_charts) for more information.\n\nExample\n-------\n\n\u003cbr /\u003e\n\n\\\u003cscript type=\"text/javascript\" src=\"https://www.gstatic.com/charts/loader.js\"\\\u003e\\\u003c/script\\\u003e \\\u003cscript type=\"text/javascript\"\\\u003e google.charts.load('current', {'packages':\\['imagechart'\\]}); \\\u003c/script\\\u003e \\\u003cdiv id=\"chart_div\" style=\"width: 400px; height: 240px;\"\\\u003e\\\u003c/div\\\u003e google.charts.setOnLoadCallback(drawChart); function drawChart() { var options = {}; dataTable = google.visualization.arrayToDataTable(\\[ \\['Gainers',10,30,45,60\\], \\['Losers',20,35,25,45\\], \\], true); var chart = new google.visualization.ImageCandlestickChart(document.getElementById('chart_div')); chart.draw(dataTable, options); } \n\n```html\n\u003chtml\u003e\n \u003chead\u003e\n \u003cscript type=\"text/javascript\" src=\"https://www.gstatic.com/charts/loader.js\"\u003e\u003c/script\u003e\n \u003cscript type=\"text/javascript\"\u003e\n google.charts.load(\"current\", {packages:[\"imagechart\"]});\n google.charts.setOnLoadCallback(drawChart);\n\n function drawChart() {\n\n var options = {};\n dataTable = google.visualization.arrayToDataTable([\n ['Gainers',10,30,45,60],\n ['Losers',20,35,25,45],\n ], true);\n\n var chart = new google.visualization.ImageCandlestickChart(document.getElementById('chart_div'));\n chart.draw(dataTable, options);\n }\n \u003c/script\u003e\n \u003c/head\u003e\n \u003cbody\u003e\n \u003cdiv id=\"chart_div\" style=\"width: 400px; height: 240px;\"\u003e\u003c/div\u003e\n \u003c/body\u003e\n\u003c/html\u003e\n```\n\nLoading\n-------\n\n\nThe `google.charts.load` package name is `\"imagechart\"`. \n\n```transact-sql\n google.charts.load('current', {packages: [imagechart]});\n```\n\n\nThe visualization's class name is `google.visualization.`ImageCandlestickChart. \n\n```gdscript\n var visualization = new google.visualization.ImageCandlestickChart(container);\n```\n\nData Format\n-----------\n\nFive columns, where each row describes a single candlestick marker:\n\n- **Col 0:** String used as a label for this marker on the X axis.\n- **Col 1:** Number specifying the low/minimum value of this marker. This is the base of the black line.\n- **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 green; otherwise it will be red.\n- **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 red; otherwise it will be green.\n- **Col 4:** Number specifying the high/maximum value of this marker. This is the top of the black line.\n\nConfiguration Options\n---------------------\n\nIn addition to the options supported by the [Generic Image Chart](/chart/interactive/docs/gallery/genericimagechart#Configuration_Options),\nthe Candlestick Chart supports the following options:\n\n| Name | Type | Default | Description |\n|-------------------------|---------|----------------------------------|-------------------------------------------------------------------------------------------------------------------|\n| backgroundColor | string | '#FFFFFF' (white) | The background color for the chart. This is a #RRGGBB string, including the # mark. |\n| showAxisLines | boolean | true | Whether to show the axis lines. If set to false, then the axis labels will also not be shown. |\n| height | number | Height of the containing element | Height of the chart, in pixels. If 30 \\\u003c *height* or *height* \\\u003e 1,000 then this value will default to 200. |\n| max | number | Maximum data value | The maximum Y axis value. |\n| min | number | Minimum data value | The minimum Y axis value. |\n| showCategoryLabels | boolean | true | If false, hides the X axis labels. |\n| showValueLabels | boolean | true | If false, hides the Y axis labels. |\n| showValueLabelsInternal | number | auto | The spacing between the Y axis labels, in pixels. |\n| title | string | '' | Text to display above the chart. |\n| width | number | Width of the containing element | Width of the chart, in pixels. If *width* is less than 30 or greater than 1,000, then *width* will be set to 300. |\n\nMethods\n-------\n\n| Method | Return Type | Description |\n|-----------------------|-------------|------------------|\n| `draw(data, options)` | none | Draws the chart. |\n\nEvents\n------\n\nYou can register to hear the events described on the [Generic\nImage Chart](/chart/interactive/docs/gallery/genericimagechart#Events) page.\n\nData Policy\n-----------\n\n\nPlease refer to the [Chart API logging policy](/chart/interactive/faq#logging)."]]