@alphacharts/core 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # @alphacharts/core
2
2
 
3
- The AlphaCharts engine: WebGL2 series (candles, line, area, histogram, ...), Canvas2D text, panes, price and time
3
+ The alphacharts engine: WebGL2 series (candles, line, area, histogram, ...), Canvas2D text, panes, price and time
4
4
  scales, crosshair, markers, price lines, synced charts and a datafeed driver. No runtime dependencies. WebGL2 is
5
- required.
5
+ used when available, with a Canvas2D fallback (`renderer: "auto" | "webgl" | "canvas2d"`).
6
6
 
7
7
  ```
8
8
  npm install @alphacharts/core
@@ -12,12 +12,27 @@ npm install @alphacharts/core
12
12
  import { createChart } from "@alphacharts/core";
13
13
 
14
14
  const chart = createChart(el, { theme: "dark", timeZone: "UTC" });
15
- const candles = chart.addSeries("candles", { minMove: 0.05 });
15
+ const candles = chart.addSeries("candles", { priceFormat: { type: "price", minMove: 0.05 } });
16
16
  candles.setData(bars); // [{ time, open, high, low, close }], time in UTC ms
17
17
  candles.update(bar); // live: same time replaces, later time appends
18
18
  chart.createPriceLine(candles, { price: 100, title: "target" });
19
19
  ```
20
20
 
21
+ Colour individual candles or bars, and shade a pane's background per bar:
22
+
23
+ ```ts
24
+ candles.setBarColors({ time: Float64Array.of(t1, t2), color: Uint32Array.of(0xffd835ff, 0) }); // 0xRRGGBBAA, 0 = the up/down colours
25
+ candles.clearBarColors(); // exactly as before, column and all
26
+ candles.attachPrimitive(new BarShading()); // .set(times, colors) / .setAt(time, color): behind the series, no part in autoscale
27
+ ```
28
+
29
+ A bar's colour belongs to (series, time): `update`, `prepend` and `setData` keep the colours of the bars they keep, `OhlcBar.color` and
30
+ `ColumnarOhlc.color` set them from the data. The colour column is added to the store, and to the level-of-detail pyramid (a bucket takes the last coloured
31
+ bar's colour), the first time a colour is written; a series never coloured has no such column, and its candle and bar shaders do one
32
+ integer compare per vertex on the colour slot every GPU record already carries (no added buffer). A value series' points
33
+ may carry their own colour too (`ValuePoint.color`), which the line renderers draw per segment (the colour of the point the segment arrives at), in WebGL and Canvas2D.
34
+ `DataChange.kind` has a new value, `"color"`, announced to renderers only: plugins such as studies are not told, because nothing they follow moved.
35
+
21
36
  Hide the Alphabench brand mark with `createChart(el, { watermark: { visible: false } })`.
22
37
 
23
38
  `@alphacharts/core/internal` exposes rendering internals for the sibling series packages (`chart-types`,