Expose lowercase plot package from src/module.zi
This commit is contained in:
1 parent
262f2871d4
commit
8aaf46142e
9 files changed
+37
-25
No files matched your search
@@ -1,6 +1,6 @@
|
||||
# Plot
|
||||
|
||||
Plot is a Ziran app package that depends on the separate Kryon package. Its candle
|
||||
`plot` is a Ziran app package that depends on the separate Kryon package. Its candle
|
||||
chart draws OHLC bodies and wicks, volume, SMA 20, SMA 50, and EMA 20 over
|
||||
Kryon's generic `Plot` surface. `ChartMarker` and `CandleMarkers` add dated,
|
||||
clickable markers while leaving each marker's meaning to the caller. It also
|
||||
@@ -12,18 +12,28 @@ Install the Ziran launcher once with `make install-user` in Ziran, then run
|
||||
`ziran fetch` and `make build` here. `make run` opens a small demo on the Cairo
|
||||
backend; `make check` checks the source and runs the nonvisual indicator test.
|
||||
The checked-in `ziran.lock` pins both Ziran and Kryon to exact commits. Plot
|
||||
exports `Plot/module.zi` for other packages. That module re-exports Plot's
|
||||
exports `src/module.zi` for other packages. That module re-exports Plot's
|
||||
charts and Kryon's public UI surface; app code can use
|
||||
`using Charts :: #import "Plot";`.
|
||||
`using Charts :: #import "plot";`.
|
||||
|
||||
To add Plot to another Ziran project, run:
|
||||
|
||||
```sh
|
||||
ziran add Plot --git https://github.com/kryonlabs/plot.git
|
||||
ziran add kryonlabs/plot
|
||||
```
|
||||
|
||||
The resulting lockfile includes Plot and its Kryon dependency.
|
||||
Then import its public module:
|
||||
|
||||
Other applications can still use `src/candle_chart.zi` and
|
||||
`src/line_chart.zi` while packaging of reusable chart modules is being
|
||||
finished. Atr currently links those sources from its `src/` directory.
|
||||
```zi
|
||||
using Charts :: #import "plot";
|
||||
```
|
||||
|
||||
The package exports `PriceBar`, `CandleChartProps`, `CandleChart`,
|
||||
`CandleRangeFor`, `ChartMarker`, `CandleMarkers`, `SMAAt`, `EMAAt`, and
|
||||
the line chart API. Ziran locks Plot and Kryon to exact commits. No source
|
||||
links or copied chart files are needed in a consuming package. Run
|
||||
`ziran update` to refresh every dependency in a project, or
|
||||
`ziran update kryon` in this package to refresh only Kryon.
|
||||
|
||||
ATR currently uses source links while its older project layout is migrated
|
||||
to a Ziran package manifest. Other packages can use the dependency directly.
|
||||
@@ -1,4 +0,0 @@
|
||||
// Plot's reusable chart API, independent of the demo application's entry.
|
||||
using UI :: #import "Kryon";
|
||||
using Candle :: #import "candle_chart";
|
||||
using Line :: #import "line_chart";
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
using Charts :: #import "Plot";
|
||||
using Charts :: #import "module";
|
||||
|
||||
#program_export
|
||||
Frame :: (session: Session, viewport: Rectangle) -> s32 {
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
using UI :: #import "Kryon";
|
||||
using PlotWidget :: #import "PlotWidget";
|
||||
using UI :: #import "kryon";
|
||||
using PlotWidget :: #import "plot_widget";
|
||||
|
||||
PriceBar :: struct {
|
||||
timestamp: s64
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
using UI :: #import "Kryon";
|
||||
using PlotWidget :: #import "PlotWidget";
|
||||
using UI :: #import "kryon";
|
||||
using PlotWidget :: #import "plot_widget";
|
||||
|
||||
ChartRange :: struct {
|
||||
low: float32
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
// Reusable chart API, independent of the demo application's entry.
|
||||
using UI :: #import "kryon";
|
||||
using Candle :: #import "candle_chart";
|
||||
using Line :: #import "line_chart";
|
||||
@@ -1,5 +1,5 @@
|
||||
#import "candle_chart"
|
||||
using UI :: #import "Kryon";
|
||||
using UI :: #import "kryon";
|
||||
|
||||
#program_export
|
||||
main :: () -> s32 {
|
||||
|
||||
+4
-4
@@ -2,9 +2,9 @@
|
||||
"format": 1,
|
||||
"packages": [
|
||||
{
|
||||
"commit": "4235447bbd0fa9bf42dcc276381cb1c3dd55f5a2",
|
||||
"commit": "938c41faece4b821c76318c45efa051ddb85604f",
|
||||
"dependencies": {},
|
||||
"id": "pc63f351f658a1a15",
|
||||
"id": "pfc84fe5aa8556c7c",
|
||||
"name": "Kryon",
|
||||
"ref": "master",
|
||||
"url": "https://github.com/kryonlabs/kryon.git"
|
||||
@@ -12,9 +12,9 @@
|
||||
],
|
||||
"root": {
|
||||
"dependencies": {
|
||||
"Kryon": "pc63f351f658a1a15"
|
||||
"kryon": "pfc84fe5aa8556c7c"
|
||||
},
|
||||
"name": "Plot"
|
||||
"name": "plot"
|
||||
},
|
||||
"toolchain": {
|
||||
"commit": "f3374188260b7c2fc497f0abed1d38fcb822547a",
|
||||
|
||||
+5
-3
@@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "Plot"
|
||||
name = "plot"
|
||||
entry = "src/app.zi"
|
||||
module_roots = ["src", "tests"]
|
||||
bridge_modules = ["app"]
|
||||
@@ -8,12 +8,14 @@ bridge_modules = ["app"]
|
||||
git = "https://github.com/ziranlang/ziran.git"
|
||||
ref = "master"
|
||||
|
||||
[dependencies.Kryon]
|
||||
[dependencies.kryon]
|
||||
git = "https://github.com/kryonlabs/kryon.git"
|
||||
ref = "master"
|
||||
module_aliases = { Kryon = "kryon", PlotWidget = "plot_widget" }
|
||||
|
||||
[exports]
|
||||
Plot = "src/Plot/module.zi"
|
||||
plot = "src/module.zi"
|
||||
Plot = "src/module.zi"
|
||||
|
||||
[tool.kryon]
|
||||
default_profile = "cairo"
|
||||
|
||||
Reference in new issue
Block a user