A bundle that shows values against a good range could not draw a band chart, because the chart measures and paints with Kryon's native modules. The chart's records move to band_chart_props, a bundle built with KRYON_HOSTED_UI submits the chart as BandChartHostedHost, and a host answers it with BandChartHostCall from band_chart_host, which decodes the records with a codec generated on top of Kryon's widget codec. The check builds the bundles as ZX, which the toolchain now runs.
21 lines
744 B
Ziran
21 lines
744 B
Ziran
// A portable bundle's BandChart forwards its props, points and bands to the
|
|
// host, and returns the point the host says shows its label.
|
|
#import "kryon/session"
|
|
#import "band_chart"
|
|
#import "band_chart_props"
|
|
#import "band_chart_hosted_provider"
|
|
|
|
#program_export
|
|
main :: () -> s32 {
|
|
session := Session.{.slot = 4, .epoch = cast(u64)12}
|
|
points: [2]BandChartPoint = .[BandChartPoint.{.slot = 0, .value = 1.0, .good = 1,
|
|
.label = "One"}, BandChartPoint.{.slot = 1, .value = 2.0}]
|
|
bands: [1]BandChartBand = .[BandChartBand.{.low = 1.0, .has_low = true}]
|
|
shown := BandChart(session, BandChartProps.{.slots = 7, .max_value = 2.0}, points[:],
|
|
bands[:])
|
|
if shown.shown != 1 {
|
|
return 1
|
|
}
|
|
return 0
|
|
}
|