Candlestick
The open, high, low and close of each row, as a candle with a wick.
Candlestick chart
Each row is a candle. The body goes from the open to the close, and the wick from the low to the high. If the close is at or above the open, the price went up and the body is hollow. If the close is below the open, the body is filled.
The candlestick chart is an additional type. If you want to use it, load it before the charts are made. See Load it.
euro, per day
| Day | Open | High | Low | Close |
|---|---|---|---|---|
| 2 Mar | 24.00 | 24.55 | 23.17 | 23.34 |
| 3 Mar | 23.26 | 23.94 | 23.06 | 23.62 |
| 4 Mar | 23.69 | 24.42 | 23.28 | 24.09 |
| 5 Mar | 24.13 | 24.76 | 23.91 | 24.62 |
| 6 Mar | 24.68 | 25.03 | 24.27 | 25.00 |
| 9 Mar | 24.99 | 26.11 | 24.92 | 25.62 |
| 10 Mar | 25.63 | 26.68 | 25.24 | 26.26 |
| 11 Mar | 26.29 | 27.45 | 26.06 | 26.91 |
| 12 Mar | 26.86 | 27.57 | 26.76 | 27.37 |
| 13 Mar | 27.31 | 27.49 | 26.69 | 27.25 |
| 16 Mar | 27.27 | 28.16 | 27.23 | 27.63 |
| 17 Mar | 27.56 | 28.00 | 27.31 | 27.69 |
| 18 Mar | 27.60 | 28.25 | 27.38 | 28.21 |
| 19 Mar | 28.17 | 28.99 | 27.86 | 28.44 |
| 20 Mar | 28.34 | 28.51 | 28.03 | 28.25 |
| 23 Mar | 28.22 | 28.54 | 27.66 | 28.03 |
| 24 Mar | 27.95 | 28.84 | 27.43 | 28.56 |
| 25 Mar | 28.60 | 29.14 | 28.30 | 28.83 |
| 26 Mar | 28.89 | 29.79 | 28.47 | 29.55 |
| 27 Mar | 29.47 | 29.85 | 29.27 | 29.64 |
| 30 Mar | 29.60 | 30.59 | 29.54 | 30.06 |
| 31 Mar | 30.15 | 30.40 | 29.51 | 29.61 |
| 1 Apr | 29.48 | 30.35 | 29.10 | 30.22 |
| 2 Apr | 30.11 | 30.46 | 30.01 | 30.09 |
<figure data-chart="candlestick">
<figcaption><b>The price of an orchard share</b><br><span>euro, per day</span></figcaption>
<table>
<thead>
<tr><th>Day</th><th>Open</th><th>High</th><th>Low</th><th>Close</th></tr>
</thead>
<tbody>
<tr><th>2 Mar</th><td>24.00</td><td>24.55</td><td>23.17</td><td>23.34</td></tr>
<tr><th>3 Mar</th><td>23.26</td><td>23.94</td><td>23.06</td><td>23.62</td></tr>
<tr><th>4 Mar</th><td>23.69</td><td>24.42</td><td>23.28</td><td>24.09</td></tr>
<tr><th>5 Mar</th><td>24.13</td><td>24.76</td><td>23.91</td><td>24.62</td></tr>
<tr><th>6 Mar</th><td>24.68</td><td>25.03</td><td>24.27</td><td>25.00</td></tr>
…
<tr><th>1 Apr</th><td>29.48</td><td>30.35</td><td>29.10</td><td>30.22</td></tr>
<tr><th>2 Apr</th><td>30.11</td><td>30.46</td><td>30.01</td><td>30.09</td></tr>
</tbody>
</table>
</figure>
The scale fits the prices, from a little under the lowest low to a little over the highest high. It does not start at zero. If you want to set it yourself, add data-chart-scale. See The scale.
The table
The first four value columns are the open, the high, the low and the close, in that order. Their headers are the names in the tooltip, so they can be in any language.
If a row has no number in one of the four columns, it has no candle. The row stays in the table.
If rows next to each other have the same short name in data-short, such as the month, the name is shown once under the chart. See Many rows.
What if the candles do not fit?
A candle needs at least 4 pixels: a free pixel, then its body with an outline of a pixel on each side. If the rows do not all fit, the chart will be cropped.
On a phone, the following candlestick chart shows the last part of the half year. On a wide screen, it shows all of it.
euro, per day
| Day | Open | High | Low | Close |
|---|---|---|---|---|
| 2 Mar | 24.00 | 24.27 | 23.16 | 23.34 |
| 3 Mar | 23.21 | 24.00 | 22.90 | 23.75 |
| 4 Mar | 23.74 | 23.91 | 23.61 | 23.75 |
| 5 Mar | 23.81 | 24.04 | 23.00 | 23.35 |
| 6 Mar | 23.45 | 23.50 | 23.19 | 23.32 |
| 9 Mar | 23.39 | 23.90 | 23.11 | 23.57 |
| 10 Mar | 23.49 | 23.96 | 23.25 | 23.26 |
| 11 Mar | 23.17 | 23.74 | 23.16 | 23.32 |
| 12 Mar | 23.28 | 24.18 | 23.22 | 23.86 |
| 13 Mar | 23.90 | 24.78 | 23.36 | 24.58 |
| 16 Mar | 24.44 | 25.27 | 23.87 | 24.78 |
| 17 Mar | 24.72 | 25.20 | 23.73 | 24.30 |
| 18 Mar | 24.37 | 25.59 | 24.11 | 25.11 |
| 19 Mar | 25.03 | 25.25 | 24.46 | 25.24 |
| 20 Mar | 25.34 | 25.86 | 25.17 | 25.17 |
| 23 Mar | 25.22 | 26.22 | 24.81 | 25.90 |
| 24 Mar | 25.90 | 26.69 | 25.34 | 26.43 |
| 25 Mar | 26.58 | 27.07 | 26.22 | 26.52 |
| 26 Mar | 26.44 | 26.47 | 25.35 | 25.85 |
| 27 Mar | 25.73 | 26.06 | 25.34 | 25.56 |
| 30 Mar | 25.56 | 25.78 | 24.94 | 25.05 |
| 31 Mar | 25.07 | 25.74 | 25.01 | 25.18 |
| 1 Apr | 25.32 | 26.52 | 24.99 | 26.06 |
| 2 Apr | 26.02 | 26.95 | 25.72 | 26.57 |
| 3 Apr | 26.51 | 26.75 | 25.93 | 26.60 |
| 6 Apr | 26.62 | 27.32 | 26.52 | 27.23 |
| 7 Apr | 27.37 | 27.85 | 26.88 | 27.68 |
| 8 Apr | 27.64 | 28.50 | 27.34 | 28.21 |
| 9 Apr | 28.13 | 28.61 | 27.09 | 27.62 |
| 10 Apr | 27.54 | 28.15 | 27.03 | 27.95 |
| 13 Apr | 27.93 | 27.94 | 27.25 | 27.27 |
| 14 Apr | 27.29 | 27.77 | 26.85 | 27.04 |
| 15 Apr | 27.08 | 28.11 | 26.63 | 27.81 |
| 16 Apr | 27.71 | 28.27 | 27.57 | 27.97 |
| 17 Apr | 27.90 | 28.31 | 27.63 | 27.94 |
| 20 Apr | 27.88 | 28.21 | 27.81 | 27.91 |
| 21 Apr | 27.95 | 28.73 | 27.61 | 28.43 |
| 22 Apr | 28.35 | 29.00 | 28.28 | 28.77 |
| 23 Apr | 28.79 | 28.91 | 28.37 | 28.68 |
| 24 Apr | 28.80 | 28.90 | 28.19 | 28.70 |
| 27 Apr | 28.80 | 29.30 | 28.63 | 29.16 |
| 28 Apr | 29.08 | 29.63 | 28.44 | 28.85 |
| 29 Apr | 28.87 | 29.18 | 28.54 | 28.81 |
| 30 Apr | 28.88 | 29.35 | 27.77 | 28.24 |
| 1 May | 28.10 | 28.83 | 27.73 | 28.54 |
| 4 May | 28.39 | 29.50 | 27.85 | 28.91 |
| 5 May | 28.84 | 29.06 | 28.13 | 28.41 |
| 6 May | 28.56 | 29.24 | 28.45 | 28.96 |
| 7 May | 28.98 | 29.76 | 28.79 | 29.17 |
| 8 May | 29.04 | 29.62 | 28.53 | 29.03 |
| 11 May | 28.91 | 29.49 | 28.39 | 29.06 |
| 12 May | 29.06 | 29.17 | 28.36 | 28.91 |
| 13 May | 28.96 | 29.29 | 28.29 | 28.49 |
| 14 May | 28.53 | 29.07 | 28.20 | 29.05 |
| 15 May | 29.16 | 30.10 | 29.07 | 29.64 |
| 18 May | 29.55 | 30.40 | 29.49 | 29.94 |
| 19 May | 30.00 | 30.76 | 29.80 | 30.53 |
| 20 May | 30.53 | 30.58 | 29.83 | 30.15 |
| 21 May | 30.23 | 31.27 | 29.66 | 30.95 |
| 22 May | 31.07 | 31.61 | 30.65 | 30.93 |
| 25 May | 30.98 | 31.80 | 30.89 | 31.29 |
| 26 May | 31.41 | 31.60 | 30.18 | 30.77 |
| 27 May | 30.83 | 31.95 | 30.83 | 31.48 |
| 28 May | 31.33 | 31.39 | 31.03 | 31.39 |
| 29 May | 31.41 | 31.76 | 31.26 | 31.47 |
| 1 Jun | 31.38 | 31.90 | 31.35 | 31.84 |
| 2 Jun | 31.96 | 32.51 | 31.65 | 31.86 |
| 3 Jun | 31.82 | 32.57 | 31.53 | 32.41 |
| 4 Jun | 32.38 | 32.96 | 31.76 | 32.13 |
| 5 Jun | 32.02 | 32.50 | 31.63 | 32.12 |
| 8 Jun | 32.00 | 32.08 | 31.47 | 31.53 |
| 9 Jun | 31.63 | 31.94 | 31.33 | 31.93 |
| 10 Jun | 31.89 | 32.66 | 31.83 | 32.09 |
| 11 Jun | 32.16 | 33.21 | 31.82 | 32.72 |
| 12 Jun | 32.60 | 33.19 | 32.13 | 32.52 |
| 15 Jun | 32.60 | 33.03 | 32.38 | 32.86 |
| 16 Jun | 33.00 | 33.56 | 32.70 | 33.21 |
| 17 Jun | 33.21 | 33.71 | 32.98 | 33.53 |
| 18 Jun | 33.62 | 33.90 | 32.72 | 33.09 |
| 19 Jun | 33.16 | 33.77 | 32.96 | 33.31 |
| 22 Jun | 33.30 | 34.04 | 33.22 | 33.96 |
| 23 Jun | 33.95 | 34.47 | 33.70 | 33.98 |
| 24 Jun | 33.97 | 34.74 | 33.46 | 34.29 |
| 25 Jun | 34.16 | 34.71 | 33.82 | 33.96 |
| 26 Jun | 33.89 | 34.40 | 33.29 | 33.33 |
| 29 Jun | 33.42 | 33.68 | 32.91 | 33.31 |
| 30 Jun | 33.16 | 34.04 | 33.12 | 33.80 |
| 1 Jul | 33.76 | 33.89 | 33.34 | 33.85 |
| 2 Jul | 33.78 | 34.18 | 33.20 | 33.71 |
| 3 Jul | 33.76 | 34.23 | 33.04 | 33.62 |
| 6 Jul | 33.69 | 33.79 | 33.20 | 33.21 |
| 7 Jul | 33.08 | 33.14 | 31.87 | 32.43 |
| 8 Jul | 32.48 | 32.99 | 32.10 | 32.82 |
| 9 Jul | 32.68 | 33.55 | 32.22 | 33.40 |
| 10 Jul | 33.49 | 34.41 | 33.24 | 33.93 |
| 13 Jul | 33.86 | 34.86 | 33.82 | 34.47 |
| 14 Jul | 34.41 | 35.02 | 34.14 | 34.99 |
| 15 Jul | 35.10 | 36.12 | 34.73 | 35.55 |
| 16 Jul | 35.47 | 35.97 | 35.21 | 35.93 |
| 17 Jul | 35.99 | 36.95 | 35.82 | 36.36 |
| 20 Jul | 36.33 | 36.86 | 35.86 | 36.01 |
| 21 Jul | 36.10 | 36.79 | 35.51 | 36.74 |
| 22 Jul | 36.61 | 36.97 | 36.55 | 36.72 |
| 23 Jul | 36.62 | 37.30 | 36.36 | 36.98 |
| 24 Jul | 37.01 | 37.90 | 36.44 | 37.44 |
| 27 Jul | 37.37 | 37.65 | 37.35 | 37.49 |
| 28 Jul | 37.56 | 38.57 | 37.47 | 38.18 |
| 29 Jul | 38.08 | 38.55 | 37.78 | 38.33 |
| 30 Jul | 38.38 | 39.12 | 37.80 | 38.60 |
| 31 Jul | 38.46 | 38.65 | 38.29 | 38.39 |
| 3 Aug | 38.35 | 38.43 | 37.88 | 38.17 |
| 4 Aug | 38.29 | 38.50 | 37.75 | 38.18 |
| 5 Aug | 38.05 | 39.05 | 37.64 | 38.60 |
| 6 Aug | 38.57 | 38.86 | 37.47 | 38.02 |
| 7 Aug | 37.94 | 38.79 | 37.48 | 38.28 |
| 10 Aug | 38.33 | 39.52 | 37.92 | 39.00 |
| 11 Aug | 38.96 | 39.78 | 38.42 | 39.20 |
| 12 Aug | 39.15 | 39.33 | 38.73 | 38.88 |
| 13 Aug | 38.74 | 39.30 | 37.82 | 38.17 |
| 14 Aug | 38.25 | 39.20 | 38.17 | 38.86 |
| 17 Aug | 38.77 | 39.19 | 38.42 | 38.62 |
| 18 Aug | 38.73 | 39.01 | 38.52 | 38.69 |
| 19 Aug | 38.76 | 39.72 | 38.46 | 39.44 |
| 20 Aug | 39.36 | 39.66 | 39.06 | 39.25 |
| 21 Aug | 39.22 | 39.58 | 39.11 | 39.32 |
| 24 Aug | 39.22 | 39.71 | 38.94 | 39.66 |
<figure data-chart="candlestick" data-chart-axis="right" data-chart-grid>
<figcaption><b>Half a year of an orchard share</b><br><span>euro, per day</span></figcaption>
<table>
<thead>
<tr><th>Day</th><th>Open</th><th>High</th><th>Low</th><th>Close</th></tr>
</thead>
<tbody>
<tr><th data-short="Mar">2 Mar</th><td>24.00</td><td>24.27</td><td>23.16</td><td>23.34</td></tr>
<tr><th data-short="Mar">3 Mar</th><td>23.21</td><td>24.00</td><td>22.90</td><td>23.75</td></tr>
<tr><th data-short="Mar">4 Mar</th><td>23.74</td><td>23.91</td><td>23.61</td><td>23.75</td></tr>
<tr><th data-short="Mar">5 Mar</th><td>23.81</td><td>24.04</td><td>23.00</td><td>23.35</td></tr>
<tr><th data-short="Mar">6 Mar</th><td>23.45</td><td>23.50</td><td>23.19</td><td>23.32</td></tr>
…
<tr><th data-short="Aug">21 Aug</th><td>39.22</td><td>39.58</td><td>39.11</td><td>39.32</td></tr>
<tr><th data-short="Aug">24 Aug</th><td>39.22</td><td>39.71</td><td>38.94</td><td>39.66</td></tr>
</tbody>
</table>
</figure>
The chart will be cropped, and the user informed
If the full range of the data does not fit in the chart, the chart will start to hide the first rows, and more if the screen gets smaller or the data larger. The table and a summary still keep all rows.
If that cropping happens, then a line (the croptext in the global options) under the chart informs the user about it: "Showing the last {shown} of {rows} rows. The table still contains all rows.".
You can change that informative line with the croptext option in the global options, or do it per chart with data-chart-croptext. You can use some placeholders in it: {shown} is the number of candles that are shown, and {rows} the number of rows. Both get the number formatting of the page.
Set it globally:
init({ croptext: "Showing the last {shown} of {rows} days. The table still contains all rows." });
Or per chart type. Only candlestick charts are cropped now, but other types may be later, and words such as "trading days" only fit candlesticks. default is the text for all other types. Without it, they get the text of Tablechart:
init({
croptext: {
candlestick: "The last {shown} of {rows} trading days. The table still contains all rows.",
default: "The chart shows {shown} of {rows} rows. The others are in the table.",
},
});
Or per instance:
<figure data-chart="candlestick" data-chart-croptext="The last {shown} of {rows} trading days.">
With data-chart-keys, the line gets a translation key that ends in -crop. The text with {shown} and {rows} is in a hidden template, and a translation script translates that template by its key. If the lang attribute changes, the chart is redrawn, and the line is filled again from the template. The chart adds the line and its template itself. In the page, they look like this:
<figure data-chart="candlestick" data-chart-keys="share">
…
<p class="tablechart-crop" aria-hidden="true">
<span data-template hidden data-i18n="share-crop">Showing the last {shown} of {rows} rows. The table still contains all rows.</span>
<span>Showing the last 67 of 126 rows. The table still contains all rows.</span>
</p>
</figure>
The text for that key, in a file of the translation script:
{ "share-crop": "De laatste {shown} van {rows} rijen worden getoond. De tabel bevat nog steeds alle rijen." }
Tooltip and crosshair
If you hover over a candle (or tap it on a touch device), the tooltip shows its open, high, low and close, and the change from the open to the close in percent.
With data-chart-tooltip="crosshair", a line goes down through the candle, and a line across follows the pointer. Its label on the axis shows the value of the scale at that height. If the pointer is within 8 pixels of the open, high, low or close, the line goes to that value, with a dot on the candle, and the label shows the exact value from the table, in the colour of the candle. The label under the chart shows the name of the row. See Crosshair.
euro, per day
| Day | Open | High | Low | Close |
|---|---|---|---|---|
| 2 Mar | 24.00 | 24.55 | 23.17 | 23.34 |
| 3 Mar | 23.26 | 23.94 | 23.06 | 23.62 |
| 4 Mar | 23.69 | 24.42 | 23.28 | 24.09 |
| 5 Mar | 24.13 | 24.76 | 23.91 | 24.62 |
| 6 Mar | 24.68 | 25.03 | 24.27 | 25.00 |
| 9 Mar | 24.99 | 26.11 | 24.92 | 25.62 |
| 10 Mar | 25.63 | 26.68 | 25.24 | 26.26 |
| 11 Mar | 26.29 | 27.45 | 26.06 | 26.91 |
| 12 Mar | 26.86 | 27.57 | 26.76 | 27.37 |
| 13 Mar | 27.31 | 27.49 | 26.69 | 27.25 |
| 16 Mar | 27.27 | 28.16 | 27.23 | 27.63 |
| 17 Mar | 27.56 | 28.00 | 27.31 | 27.69 |
| 18 Mar | 27.60 | 28.25 | 27.38 | 28.21 |
| 19 Mar | 28.17 | 28.99 | 27.86 | 28.44 |
| 20 Mar | 28.34 | 28.51 | 28.03 | 28.25 |
| 23 Mar | 28.22 | 28.54 | 27.66 | 28.03 |
| 24 Mar | 27.95 | 28.84 | 27.43 | 28.56 |
| 25 Mar | 28.60 | 29.14 | 28.30 | 28.83 |
| 26 Mar | 28.89 | 29.79 | 28.47 | 29.55 |
| 27 Mar | 29.47 | 29.85 | 29.27 | 29.64 |
| 30 Mar | 29.60 | 30.59 | 29.54 | 30.06 |
| 31 Mar | 30.15 | 30.40 | 29.51 | 29.61 |
| 1 Apr | 29.48 | 30.35 | 29.10 | 30.22 |
| 2 Apr | 30.11 | 30.46 | 30.01 | 30.09 |
<figure data-chart="candlestick" data-chart-axis="right" data-chart-grid data-chart-tooltip="crosshair">
<figcaption><b>The price of an orchard share</b><br><span>euro, per day</span></figcaption>
<table>
<thead>
<tr><th>Day</th><th>Open</th><th>High</th><th>Low</th><th>Close</th></tr>
</thead>
<tbody>
<tr><th>2 Mar</th><td>24.00</td><td>24.55</td><td>23.17</td><td>23.34</td></tr>
<tr><th>3 Mar</th><td>23.26</td><td>23.94</td><td>23.06</td><td>23.62</td></tr>
<tr><th>4 Mar</th><td>23.69</td><td>24.42</td><td>23.28</td><td>24.09</td></tr>
<tr><th>5 Mar</th><td>24.13</td><td>24.76</td><td>23.91</td><td>24.62</td></tr>
<tr><th>6 Mar</th><td>24.68</td><td>25.03</td><td>24.27</td><td>25.00</td></tr>
…
<tr><th>1 Apr</th><td>29.48</td><td>30.35</td><td>29.10</td><td>30.22</td></tr>
<tr><th>2 Apr</th><td>30.11</td><td>30.46</td><td>30.01</td><td>30.09</td></tr>
</tbody>
</table>
</figure>
Summary
A summary of a candlestick chart is about the close: the fourth value column. Its rows are in order, so the summary has the change and the trend from the first close to the last. If you want a sentence about the high or the low, add data-series="2" or data-series="3".
euro, per day
| Day | Open | High | Low | Close |
|---|---|---|---|---|
| 2 Mar | 24.00 | 24.55 | 23.17 | 23.34 |
| 3 Mar | 23.26 | 23.94 | 23.06 | 23.62 |
| 4 Mar | 23.69 | 24.42 | 23.28 | 24.09 |
| 5 Mar | 24.13 | 24.76 | 23.91 | 24.62 |
| 6 Mar | 24.68 | 25.03 | 24.27 | 25.00 |
| 9 Mar | 24.99 | 26.11 | 24.92 | 25.62 |
| 10 Mar | 25.63 | 26.68 | 25.24 | 26.26 |
| 11 Mar | 26.29 | 27.45 | 26.06 | 26.91 |
| 12 Mar | 26.86 | 27.57 | 26.76 | 27.37 |
| 13 Mar | 27.31 | 27.49 | 26.69 | 27.25 |
| 16 Mar | 27.27 | 28.16 | 27.23 | 27.63 |
| 17 Mar | 27.56 | 28.00 | 27.31 | 27.69 |
| 18 Mar | 27.60 | 28.25 | 27.38 | 28.21 |
| 19 Mar | 28.17 | 28.99 | 27.86 | 28.44 |
| 20 Mar | 28.34 | 28.51 | 28.03 | 28.25 |
| 23 Mar | 28.22 | 28.54 | 27.66 | 28.03 |
| 24 Mar | 27.95 | 28.84 | 27.43 | 28.56 |
| 25 Mar | 28.60 | 29.14 | 28.30 | 28.83 |
| 26 Mar | 28.89 | 29.79 | 28.47 | 29.55 |
| 27 Mar | 29.47 | 29.85 | 29.27 | 29.64 |
| 30 Mar | 29.60 | 30.59 | 29.54 | 30.06 |
| 31 Mar | 30.15 | 30.40 | 29.51 | 29.61 |
| 1 Apr | 29.48 | 30.35 | 29.10 | 30.22 |
| 2 Apr | 30.11 | 30.46 | 30.01 | 30.09 |
From {first.name} to {last.name}, the price went up by {change.percent}, from {first.value} to {last.value}.
From {first.name} to {last.name}, the price went down by {change.percent}, from {first.value} to {last.value}.
The highest price was {highest.value}, on {highest.name}.
The lowest price was {lowest.value}, on {lowest.name}.
<figure data-chart="candlestick" data-chart-summary="always">
<figcaption><b>The price of an orchard share</b><br><span>euro, per day</span></figcaption>
<table>
<thead>
<tr><th>Day</th><th>Open</th><th>High</th><th>Low</th><th>Close</th></tr>
</thead>
<tbody>
<tr><th>2 Mar</th><td>24.00</td><td>24.55</td><td>23.17</td><td>23.34</td></tr>
<tr><th>3 Mar</th><td>23.26</td><td>23.94</td><td>23.06</td><td>23.62</td></tr>
<tr><th>4 Mar</th><td>23.69</td><td>24.42</td><td>23.28</td><td>24.09</td></tr>
<tr><th>5 Mar</th><td>24.13</td><td>24.76</td><td>23.91</td><td>24.62</td></tr>
<tr><th>6 Mar</th><td>24.68</td><td>25.03</td><td>24.27</td><td>25.00</td></tr>
…
<tr><th>1 Apr</th><td>29.48</td><td>30.35</td><td>29.10</td><td>30.22</td></tr>
<tr><th>2 Apr</th><td>30.11</td><td>30.46</td><td>30.01</td><td>30.09</td></tr>
</tbody>
</table>
<div class="chart-summary">
<p data-summary="change" data-when="up">From {first.name} to {last.name}, the price went up by {change.percent}, from {first.value} to {last.value}.</p>
<p data-summary="change" data-when="down">From {first.name} to {last.name}, the price went down by {change.percent}, from {first.value} to {last.value}.</p>
<p data-series="2">The highest price was {highest.value}, on {highest.name}.</p>
<p data-series="3">The lowest price was {lowest.value}, on {lowest.name}.</p>
</div>
</figure>
{total} and data-series="total" add the values up, which means nothing for prices.
Colours
By default, a rising and a falling candle have the same colour: the colour of the bars, --tablechart-bar-color. The hollow and filled bodies set them apart, also in print and for people who do not see colours well.
If you want other colours, set these variables. Without them, the up and down colours of the waterfall chart are used.
| Variable | Sets |
|---|---|
--tablechart-candle-up-color |
The colour of a rising candle: --tablechart-up-color by default |
--tablechart-candle-down-color |
The colour of a falling candle: --tablechart-down-color by default |
--tablechart-candle-up-fill |
The inside of a rising body: the background by default, so it is hollow |
--tablechart-candle-line-width |
How thick the wicks and the outlines of the bodies are: 1px by default |
.green-red {
--tablechart-candle-up-color: #2e7d4f;
--tablechart-candle-down-color: #c0392b;
--tablechart-candle-up-fill: #2e7d4f;
}
euro, per day
| Day | Open | High | Low | Close |
|---|---|---|---|---|
| 2 Mar | 24.00 | 24.55 | 23.17 | 23.34 |
| 3 Mar | 23.26 | 23.94 | 23.06 | 23.62 |
| 4 Mar | 23.69 | 24.42 | 23.28 | 24.09 |
| 5 Mar | 24.13 | 24.76 | 23.91 | 24.62 |
| 6 Mar | 24.68 | 25.03 | 24.27 | 25.00 |
| 9 Mar | 24.99 | 26.11 | 24.92 | 25.62 |
| 10 Mar | 25.63 | 26.68 | 25.24 | 26.26 |
| 11 Mar | 26.29 | 27.45 | 26.06 | 26.91 |
| 12 Mar | 26.86 | 27.57 | 26.76 | 27.37 |
| 13 Mar | 27.31 | 27.49 | 26.69 | 27.25 |
| 16 Mar | 27.27 | 28.16 | 27.23 | 27.63 |
| 17 Mar | 27.56 | 28.00 | 27.31 | 27.69 |
| 18 Mar | 27.60 | 28.25 | 27.38 | 28.21 |
| 19 Mar | 28.17 | 28.99 | 27.86 | 28.44 |
| 20 Mar | 28.34 | 28.51 | 28.03 | 28.25 |
| 23 Mar | 28.22 | 28.54 | 27.66 | 28.03 |
| 24 Mar | 27.95 | 28.84 | 27.43 | 28.56 |
| 25 Mar | 28.60 | 29.14 | 28.30 | 28.83 |
| 26 Mar | 28.89 | 29.79 | 28.47 | 29.55 |
| 27 Mar | 29.47 | 29.85 | 29.27 | 29.64 |
| 30 Mar | 29.60 | 30.59 | 29.54 | 30.06 |
| 31 Mar | 30.15 | 30.40 | 29.51 | 29.61 |
| 1 Apr | 29.48 | 30.35 | 29.10 | 30.22 |
| 2 Apr | 30.11 | 30.46 | 30.01 | 30.09 |
<figure class="green-red" data-chart="candlestick">
<figcaption><b>The price of an orchard share</b><br><span>euro, per day</span></figcaption>
<table>
<thead>
<tr><th>Day</th><th>Open</th><th>High</th><th>Low</th><th>Close</th></tr>
</thead>
<tbody>
<tr><th>2 Mar</th><td>24.00</td><td>24.55</td><td>23.17</td><td>23.34</td></tr>
<tr><th>3 Mar</th><td>23.26</td><td>23.94</td><td>23.06</td><td>23.62</td></tr>
<tr><th>4 Mar</th><td>23.69</td><td>24.42</td><td>23.28</td><td>24.09</td></tr>
<tr><th>5 Mar</th><td>24.13</td><td>24.76</td><td>23.91</td><td>24.62</td></tr>
<tr><th>6 Mar</th><td>24.68</td><td>25.03</td><td>24.27</td><td>25.00</td></tr>
…
<tr><th>1 Apr</th><td>29.48</td><td>30.35</td><td>29.10</td><td>30.22</td></tr>
<tr><th>2 Apr</th><td>30.11</td><td>30.46</td><td>30.01</td><td>30.09</td></tr>
</tbody>
</table>
</figure>
Green and red alone are hard to tell apart for many people. If you use them, a hollow rising body still helps.
Load it
The candlestick chart is not in the main script. It is an additional type, in a script of its own. See Additional types.
import { addType, init } from "@martinomagnifico/tablechart";
import { candlestick } from "@martinomagnifico/tablechart/additional-types";
addType("candlestick", candlestick);
init();
If you use a script tag, load tablechart-additional-types.js after tablechart.js. It adds the candlestick chart.
<script src="tablechart.js"></script>
<script src="tablechart-additional-types.js"></script>
<script>
Tablechart.init();
</script>
Next
If you want to style the axis and the gridlines, see Axes and gridlines. For all the attributes, see Attributes.