Diagram batang lilin yang dirender sebagai gambar menggunakan Google Chart API.
Diagram batang lilin digunakan untuk menampilkan nilai pembuka dan penutup yang ditempatkan di atas total varians. Diagram batang lilin sering digunakan untuk menampilkan perilaku nilai saham. Di diagram ini, item dengan nilai pembuka kurang dari nilai penutup akan digambar dengan warna hijau, dan item yang nilai pembukanya lebih besar dari nilai penutup akan digambar dengan warna merah. Lihat dokumentasi batang lilin di Google Chart API untuk informasi lebih lanjut.
Nama class visualisasi adalah google.visualization.ImageCandlestickChart.
var visualization = new google.visualization.ImageCandlestickChart(container);
Format Data
Lima kolom, dengan setiap baris mendeskripsikan satu penanda batang lilin:
Col 0: String yang digunakan sebagai label untuk penanda ini pada sumbu X.
Kol 1: Angka yang menentukan nilai rendah/minimum penanda ini. Ini adalah dasar garis hitam.
Kol 2: Angka yang menentukan nilai pembuka/awal penanda ini. Ini adalah satu batas vertikal lilin. Jika lebih kecil dari nilai kolom 3, lilin akan menjadi hijau; jika tidak, warnanya akan merah.
Kol 3: Angka yang menentukan nilai penutup/akhir penanda ini. Ini adalah batas vertikal kedua lilin. Jika lebih kecil dari nilai kolom 2, lilin akan menjadi merah; jika tidak, warnanya akan hijau.
Kol 4: Angka yang menentukan nilai tinggi/maksimum penanda ini. Ini adalah bagian atas garis hitam.
Opsi Konfigurasi
Selain opsi yang didukung oleh Generic Image Chart,
Diagram Batang Lilin mendukung opsi berikut:
Name
Jenis
Default
Deskripsi
backgroundColor
string
'#FFFFFF' (putih)
Warna latar belakang diagram. Ini adalah string #RRGGBB, termasuk tanda #.
showAxisLines
boolean
true
Menentukan apakah akan menampilkan garis sumbu. Jika disetel ke salah (false), label sumbu juga tidak akan ditampilkan.
tinggi
number
Tinggi elemen penampung
Tinggi diagram, dalam piksel. Jika 30 < height atau height > 1.000,nilai ini akan ditetapkan secara default ke 200.
max
number
Nilai data maksimum
Nilai sumbu Y maksimum.
mnt
number
Nilai data minimum
Nilai sumbu Y minimum.
showCategoryLabels
boolean
true
Jika salah, label sumbu X akan disembunyikan.
showValueLabels
boolean
true
Jika salah, label sumbu Y akan disembunyikan.
showValueLabelsInternal
number
otomatis
Spasi antara label sumbu Y, dalam piksel.
title
string
''
Teks yang akan ditampilkan di atas diagram.
lebar
number
Lebar elemen penampung
Lebar diagram, dalam piksel. Jika width kurang dari 30 atau lebih besar dari 1.000, width akan ditetapkan ke 300.
Metode
Metode
Jenis Nilai yang Ditampilkan
Deskripsi
draw(data, options)
tidak ada
Menggambar diagram.
Acara
Anda dapat mendaftar untuk mendengarkan peristiwa yang dijelaskan di halaman Generic
Image Chart.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Informasi yang saya butuhkan tidak ada","missingTheInformationINeed","thumb-down"],["Terlalu rumit/langkahnya terlalu banyak","tooComplicatedTooManySteps","thumb-down"],["Sudah usang","outOfDate","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Masalah kode / contoh","samplesCodeIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 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)."]]