You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by bi...@apache.org on 2018/03/28 02:43:07 UTC
[royale-asjs] branch feature/echarts updated: Add PieChart example
This is an automated email from the ASF dual-hosted git repository.
bigosmallm pushed a commit to branch feature/echarts
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
The following commit(s) were added to refs/heads/feature/echarts by this push:
new 92867a4 Add PieChart example
92867a4 is described below
commit 92867a4920994381512977a9a1116c637c75eb6c
Author: Om Muppirala <bi...@apache.org>
AuthorDate: Tue Mar 27 19:42:53 2018 -0700
Add PieChart example
---
examples/royale/ECharts/asconfig.json | 2 +-
examples/royale/ECharts/src/PieChartExample.mxml | 41 ++++++++++++++++++++++
.../royale/ECharts/src/echarts/EChartsOptions.as | 22 +++++++++---
3 files changed, 60 insertions(+), 5 deletions(-)
diff --git a/examples/royale/ECharts/asconfig.json b/examples/royale/ECharts/asconfig.json
index 199c007..b28e121 100644
--- a/examples/royale/ECharts/asconfig.json
+++ b/examples/royale/ECharts/asconfig.json
@@ -8,6 +8,6 @@
},
"files":
[
- "src/DataZoomExample.mxml"
+ "src/PieChartExample.mxml"
]
}
\ No newline at end of file
diff --git a/examples/royale/ECharts/src/PieChartExample.mxml b/examples/royale/ECharts/src/PieChartExample.mxml
new file mode 100644
index 0000000..2311124
--- /dev/null
+++ b/examples/royale/ECharts/src/PieChartExample.mxml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<js:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:js="library://ns.apache.org/royale/express"
+ xmlns:ns2="echarts.*"
+ initialize="onAppInitialize(event)"
+ >
+ <fx:Script>
+ <![CDATA[
+ [Bindable] private var xAxisData:Array;
+ [Bindable] private var salesData:Array;
+ [Bindable] private var profitData:Array;
+
+ private function onAppInitialize(event:Event):void
+ {
+ this.salesData = [5, 20, 36, 10, 10, 20];
+ }
+
+ ]]>
+ </fx:Script>
+ <js:initialView>
+ <js:View>
+ <ns2:ECharts id="chart">
+ <ns2:chartOptions>
+ <ns2:EChartsOptions>
+ <ns2:title>
+ <ns2:Title text="Pie Chart Example" show="true"
+ link="https://ecomfe.github.io/echarts-examples/public/index.html" target="_self" />
+ </ns2:title>
+ <ns2:seriesList>
+ <ns2:SeriesList>
+ <ns2:series>
+ <ns2:Series name="Sales" type="pie" data="{this.salesData}" />
+ </ns2:series>
+ </ns2:SeriesList>
+ </ns2:seriesList>
+ </ns2:EChartsOptions>
+ </ns2:chartOptions>
+ </ns2:ECharts>
+ </js:View>
+ </js:initialView>
+</js:Application>
\ No newline at end of file
diff --git a/examples/royale/ECharts/src/echarts/EChartsOptions.as b/examples/royale/ECharts/src/echarts/EChartsOptions.as
index 207311d..d73be7a 100644
--- a/examples/royale/ECharts/src/echarts/EChartsOptions.as
+++ b/examples/royale/ECharts/src/echarts/EChartsOptions.as
@@ -82,19 +82,33 @@ package echarts
public function get options():Object {
return {title: this.title,
- xAxis: this.xAxis.obj,
- yAxis: this.yAxis.obj,
+ xAxis: this.getXAxisObj(),
+ yAxis: this.getYAxisObj(),
series: getSeriesValues(),
dataZoom: getDataZoomValues()};
}
+ protected function getXAxisObj():Object {
+ if(this.xAxis) {
+ return this.xAxis.obj;
+ }
+ return {};
+ }
+
+ protected function getYAxisObj():Object {
+ if(this.yAxis) {
+ return this.yAxis.obj;
+ }
+ return {};
+ }
+
protected function getSeriesValues():Array {
if(this.seriesList) {
return this.seriesList.series.map(function(item:Series):Object {
return item.obj;
});
}
- else return [];
+ return [];
}
protected function getDataZoomValues():Array {
@@ -103,7 +117,7 @@ package echarts
return item.obj;
});
}
- else return [];
+ return [];
}
protected function optionsChanged(event:Event):void {
--
To stop receiving notification emails like this one, please contact
bigosmallm@apache.org.