mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
test(safe-area): add RadChart example
This commit is contained in:
committed by
Martin Yankov
parent
475326a06d
commit
9faa3c164b
@@ -14,6 +14,7 @@
|
||||
<Button text="StackLayout Examples" tap="onNavigate" route="stacklayout/stacklayout-page"></Button>
|
||||
<Button text="WrapLayout Examples" tap="onNavigate" route="wraplayout/wraplayout-page"></Button>
|
||||
<Button text="RadListView Examples" tap="onNavigate" route="radlistview/radlistview-page"></Button>
|
||||
<Button text="RadChart Examples" tap="onNavigate" route="radchart/radchart-page"></Button>
|
||||
</StackLayout>
|
||||
</ScrollView>
|
||||
|
||||
|
||||
13
e2e/safe-area/app/radchart/categorical-data-model.ts
Normal file
13
e2e/safe-area/app/radchart/categorical-data-model.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { Observable } from "tns-core-modules/data/observable";
|
||||
|
||||
export class CategoricalDataModel extends Observable {
|
||||
get categoricalSource() {
|
||||
return [
|
||||
{ Country: "Germany", Amount: 15, SecondVal: 14, ThirdVal: 24 },
|
||||
{ Country: "France", Amount: 13, SecondVal: 23, ThirdVal: 25 },
|
||||
{ Country: "Bulgaria", Amount: 24, SecondVal: 17, ThirdVal: 23 },
|
||||
{ Country: "Spain", Amount: 11, SecondVal: 19, ThirdVal: 24 },
|
||||
{ Country: "USA", Amount: 18, SecondVal: 8, ThirdVal: 21 }
|
||||
];
|
||||
}
|
||||
}
|
||||
6
e2e/safe-area/app/radchart/radchart-page.ts
Normal file
6
e2e/safe-area/app/radchart/radchart-page.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { CategoricalDataModel } from "./categorical-data-model";
|
||||
|
||||
export function onPageLoaded(args) {
|
||||
const page = args.object;
|
||||
page.bindingContext = new CategoricalDataModel();
|
||||
}
|
||||
16
e2e/safe-area/app/radchart/radchart-page.xml
Normal file
16
e2e/safe-area/app/radchart/radchart-page.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<Page class="page" loaded="onPageLoaded" xmlns:chart="nativescript-ui-chart" xmlns="http://www.nativescript.org/tns.xsd">
|
||||
|
||||
<chart:RadCartesianChart id="cartesianChart">
|
||||
<chart:RadCartesianChart.series>
|
||||
<chart:LineSeries items="{{ categoricalSource }}" categoryProperty="Country" valueProperty="Amount">
|
||||
<chart:LineSeries.horizontalAxis>
|
||||
<chart:CategoricalAxis/>
|
||||
</chart:LineSeries.horizontalAxis>
|
||||
<chart:LineSeries.verticalAxis>
|
||||
<chart:LinearAxis/>
|
||||
</chart:LineSeries.verticalAxis>
|
||||
</chart:LineSeries>
|
||||
</chart:RadCartesianChart.series>
|
||||
</chart:RadCartesianChart>
|
||||
|
||||
</Page>
|
||||
@@ -14,6 +14,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"nativescript-theme-core": "~1.0.4",
|
||||
"nativescript-ui-chart": "^3.7.0",
|
||||
"nativescript-ui-listview": "^3.5.11",
|
||||
"tns-core-modules": "*"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user