1import { Bar1DChart, Chart, Navigation, NavigationStack, Script, VStack } from "scripting"
2
3const data = [
4 { type: "Gadgets", profit: 3800 },
5 { type: "Gizmos", profit: 4400 },
6 { type: "Widgets", profit: 6500 },
7]
8
9function Example() {
10 return <NavigationStack>
11 <VStack
12 navigationTitle={"Bar1DChart"}
13 navigationBarTitleDisplayMode={"inline"}
14 >
15 <Chart
16 padding={0}
17 frame={{
18 height: 400
19 }}
20 >
21 <Bar1DChart
22 marks={data.map(item => ({
23 category: item.type,
24 value: item.profit,
25 }))}
26 />
27 </Chart>
28 </VStack>
29 </NavigationStack >
30}
31
32async function run() {
33 await Navigation.present({
34 element: <Example />
35 })
36
37 Script.exit()
38}
39
40run()