You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by pe...@apache.org on 2015/11/09 21:48:38 UTC
[3/3] git commit: [flex-asjs] [refs/heads/core_js_to_as] - Changed
Charts project for as-to-js.
Changed Charts project for as-to-js.
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/af2be21d
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/af2be21d
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/af2be21d
Branch: refs/heads/core_js_to_as
Commit: af2be21d23b04b0c7c81bbf01cad8db3c5b5706a
Parents: cc53ad1
Author: Peter Ent <pe...@apache.org>
Authored: Mon Nov 9 15:48:31 2015 -0500
Committer: Peter Ent <pe...@apache.org>
Committed: Mon Nov 9 15:48:31 2015 -0500
----------------------------------------------------------------------
frameworks/projects/Charts/as/defaults.css | 108 +++++++
.../projects/Charts/as/src/ChartsClasses.as | 27 ++
.../as/src/org/apache/flex/charts/BarChart.as | 49 ++++
.../src/org/apache/flex/charts/ColumnChart.as | 48 ++++
.../as/src/org/apache/flex/charts/LineChart.as | 48 ++++
.../as/src/org/apache/flex/charts/PieChart.as | 47 ++++
.../org/apache/flex/charts/StackedBarChart.as | 48 ++++
.../apache/flex/charts/StackedColumnChart.as | 48 ++++
.../apache/flex/charts/beads/AxisBaseBead.as | 246 ++++++++++++++++
.../charts/beads/ChartItemRendererFactory.as | 155 ++++++++++
.../org/apache/flex/charts/beads/ChartView.as | 175 ++++++++++++
.../DataItemRendererFactoryForSeriesData.as | 131 +++++++++
.../org/apache/flex/charts/beads/DataTipBead.as | 162 +++++++++++
.../charts/beads/HorizontalCategoryAxisBead.as | 191 +++++++++++++
.../charts/beads/HorizontalLinearAxisBead.as | 246 ++++++++++++++++
.../charts/beads/VerticalCategoryAxisBead.as | 198 +++++++++++++
.../flex/charts/beads/VerticalLinearAxisBead.as | 236 ++++++++++++++++
.../flex/charts/beads/layouts/BarChartLayout.as | 149 ++++++++++
.../charts/beads/layouts/ChartBaseLayout.as | 147 ++++++++++
.../charts/beads/layouts/ColumnChartLayout.as | 140 +++++++++
.../layouts/LineChartCategoryVsLinearLayout.as | 152 ++++++++++
.../layouts/LineChartLinearVsLinearLayout.as | 166 +++++++++++
.../flex/charts/beads/layouts/PieChartLayout.as | 140 +++++++++
.../beads/layouts/StackedBarChartLayout.as | 164 +++++++++++
.../beads/layouts/StackedColumnChartLayout.as | 161 +++++++++++
.../flex/charts/optimized/SVGBoxItemRenderer.as | 166 +++++++++++
.../flex/charts/optimized/SVGChartAxisGroup.as | 142 ++++++++++
.../flex/charts/optimized/SVGChartDataGroup.as | 192 +++++++++++++
.../optimized/SVGLineSegmentItemRenderer.as | 205 ++++++++++++++
.../charts/optimized/SVGWedgeItemRenderer.as | 281 +++++++++++++++++++
.../flex/charts/supportClasses/BarSeries.as | 103 +++++++
.../charts/supportClasses/BoxItemRenderer.as | 254 +++++++++++++++++
.../charts/supportClasses/ChartAxisGroup.as | 11 +-
.../charts/supportClasses/ChartDataGroup.as | 8 +-
.../flex/charts/supportClasses/ColumnSeries.as | 93 ++++++
.../supportClasses/ILineSegmentItemRenderer.as | 57 ++++
.../charts/supportClasses/IWedgeItemRenderer.as | 113 ++++++++
.../supportClasses/LineSegmentItemRenderer.as | 198 +++++++++++++
.../flex/charts/supportClasses/LineSeries.as | 114 ++++++++
.../flex/charts/supportClasses/PieSeries.as | 85 ++++++
.../charts/supportClasses/WedgeItemRenderer.as | 272 ++++++++++++++++++
frameworks/projects/Charts/build.xml | 94 ++++---
.../projects/Charts/compile-as-to-js-config.xml | 76 +++++
.../projects/Charts/compile-asjs-config.xml | 5 +-
frameworks/projects/Charts/compile-config.xml | 4 +-
.../projects/Charts/compile-js-config.xml | 87 ++++++
46 files changed, 5885 insertions(+), 57 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/defaults.css
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/defaults.css b/frameworks/projects/Charts/as/defaults.css
new file mode 100644
index 0000000..de87e21
--- /dev/null
+++ b/frameworks/projects/Charts/as/defaults.css
@@ -0,0 +1,108 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+@namespace "library://ns.apache.org/flexjs/basic";
+
+BarChart
+{
+ IBeadModel: ClassReference("org.apache.flex.html.beads.models.ArraySelectionModel");
+ IBeadView: ClassReference("org.apache.flex.charts.beads.ChartView");
+ IBeadController: ClassReference("org.apache.flex.html.beads.controllers.ListSingleSelectionMouseController");
+ IBeadLayout: ClassReference("org.apache.flex.charts.beads.layouts.BarChartLayout");
+ IContentView: ClassReference("org.apache.flex.charts.supportClasses.ChartDataGroup");
+ IDataProviderItemRendererMapper: ClassReference("org.apache.flex.charts.beads.DataItemRendererFactoryForSeriesData");
+ IItemRenderer: ClassReference("org.apache.flex.charts.supportClasses.BoxItemRenderer");
+ IHorizontalAxisGroup: ClassReference("org.apache.flex.charts.supportClasses.ChartAxisGroup");
+ IVerticalAxisGroup: ClassReference("org.apache.flex.charts.supportClasses.ChartAxisGroup");
+ IViewport: ClassReference("org.apache.flex.html.supportClasses.Viewport");
+}
+
+BoxItemRenderer
+{
+ IBeadController: ClassReference("org.apache.flex.html.beads.controllers.ItemRendererMouseController");
+}
+
+ColumnChart
+{
+ IBeadModel: ClassReference("org.apache.flex.html.beads.models.ArraySelectionModel");
+ IBeadView: ClassReference("org.apache.flex.charts.beads.ChartView");
+ IBeadController: ClassReference("org.apache.flex.html.beads.controllers.ListSingleSelectionMouseController");
+ IBeadLayout: ClassReference("org.apache.flex.charts.beads.layouts.ColumnChartLayout");
+ IContentView: ClassReference("org.apache.flex.charts.supportClasses.ChartDataGroup");
+ IDataProviderItemRendererMapper: ClassReference("org.apache.flex.charts.beads.DataItemRendererFactoryForSeriesData");
+ IItemRenderer: ClassReference("org.apache.flex.charts.supportClasses.BoxItemRenderer");
+ IHorizontalAxisGroup: ClassReference("org.apache.flex.charts.supportClasses.ChartAxisGroup");
+ IVerticalAxisGroup: ClassReference("org.apache.flex.charts.supportClasses.ChartAxisGroup");
+ IViewport: ClassReference("org.apache.flex.html.supportClasses.Viewport");
+}
+
+LineChart
+{
+ IBeadModel: ClassReference("org.apache.flex.html.beads.models.ArraySelectionModel");
+ IBeadView: ClassReference("org.apache.flex.charts.beads.ChartView");
+ IBeadController: ClassReference("org.apache.flex.html.beads.controllers.ListSingleSelectionMouseController");
+ IBeadLayout: ClassReference("org.apache.flex.charts.beads.layouts.LineChartCategoryVsLinearLayout");
+ IContentView: ClassReference("org.apache.flex.charts.supportClasses.ChartDataGroup");
+ IDataProviderItemRendererMapper: ClassReference("org.apache.flex.charts.beads.DataItemRendererFactoryForSeriesData");
+ IItemRenderer: ClassReference("org.apache.flex.charts.supportClasses.BoxItemRenderer");
+ IConnectedItemRenderer: ClassReference("org.apache.flex.charts.supportClasses.LineSegmentItemRenderer");
+ IHorizontalAxisGroup: ClassReference("org.apache.flex.charts.supportClasses.ChartAxisGroup");
+ IVerticalAxisGroup: ClassReference("org.apache.flex.charts.supportClasses.ChartAxisGroup");
+ IViewport: ClassReference("org.apache.flex.html.supportClasses.Viewport");
+}
+
+PieChart
+{
+ IBeadModel: ClassReference("org.apache.flex.html.beads.models.ArraySelectionModel");
+ IBeadView: ClassReference("org.apache.flex.charts.beads.ChartView");
+ IBeadController: ClassReference("org.apache.flex.html.beads.controllers.ListSingleSelectionMouseController");
+ IBeadLayout: ClassReference("org.apache.flex.charts.beads.layouts.PieChartLayout");
+ IContentView: ClassReference("org.apache.flex.charts.supportClasses.ChartDataGroup");
+ IDataProviderItemRendererMapper: ClassReference("org.apache.flex.charts.beads.DataItemRendererFactoryForSeriesData");
+ IItemRenderer: ClassReference("org.apache.flex.charts.supportClasses.WedgeItemRenderer");
+ IViewport: ClassReference("org.apache.flex.html.supportClasses.Viewport");
+}
+
+StackedColumnChart
+{
+ IBeadModel: ClassReference("org.apache.flex.html.beads.models.ArraySelectionModel");
+ IBeadView: ClassReference("org.apache.flex.charts.beads.ChartView");
+ IBeadController: ClassReference("org.apache.flex.html.beads.controllers.ListSingleSelectionMouseController");
+ IBeadLayout: ClassReference("org.apache.flex.charts.beads.layouts.StackedColumnChartLayout");
+ IContentView: ClassReference("org.apache.flex.charts.supportClasses.ChartDataGroup");
+ IDataProviderItemRendererMapper: ClassReference("org.apache.flex.charts.beads.DataItemRendererFactoryForSeriesData");
+ IItemRenderer: ClassReference("org.apache.flex.charts.supportClasses.BoxItemRenderer");
+ IHorizontalAxisGroup: ClassReference("org.apache.flex.charts.supportClasses.ChartAxisGroup");
+ IVerticalAxisGroup: ClassReference("org.apache.flex.charts.supportClasses.ChartAxisGroup");
+ IViewport: ClassReference("org.apache.flex.html.supportClasses.Viewport");
+}
+
+StackedBarChart
+{
+ IBeadModel: ClassReference("org.apache.flex.html.beads.models.ArraySelectionModel");
+ IBeadView: ClassReference("org.apache.flex.charts.beads.ChartView");
+ IBeadController: ClassReference("org.apache.flex.html.beads.controllers.ListSingleSelectionMouseController");
+ IBeadLayout: ClassReference("org.apache.flex.charts.beads.layouts.StackedBarChartLayout");
+ IContentView: ClassReference("org.apache.flex.charts.supportClasses.ChartDataGroup");
+ IDataProviderItemRendererMapper: ClassReference("org.apache.flex.charts.beads.DataItemRendererFactoryForSeriesData");
+ IItemRenderer: ClassReference("org.apache.flex.charts.supportClasses.BoxItemRenderer");
+ IHorizontalAxisGroup: ClassReference("org.apache.flex.charts.supportClasses.ChartAxisGroup");
+ IVerticalAxisGroup: ClassReference("org.apache.flex.charts.supportClasses.ChartAxisGroup");
+ IViewport: ClassReference("org.apache.flex.html.supportClasses.Viewport");
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/ChartsClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/ChartsClasses.as b/frameworks/projects/Charts/as/src/ChartsClasses.as
index b0be738..dc303a5 100644
--- a/frameworks/projects/Charts/as/src/ChartsClasses.as
+++ b/frameworks/projects/Charts/as/src/ChartsClasses.as
@@ -42,6 +42,33 @@ internal class ChartsClasses
import org.apache.flex.charts.core.PolarChart; PolarChart;
import org.apache.flex.charts.supportClasses.ChartAxisGroup; ChartAxisGroup;
import org.apache.flex.charts.supportClasses.ChartDataGroup; ChartDataGroup;
+
+ import org.apache.flex.charts.beads.ChartView; ChartView;
+ import org.apache.flex.charts.beads.ChartItemRendererFactory; ChartItemRendererFactory;
+ import org.apache.flex.charts.beads.DataItemRendererFactoryForSeriesData; DataItemRendererFactoryForSeriesData;
+ import org.apache.flex.charts.beads.DataTipBead; DataTipBead;
+ import org.apache.flex.charts.beads.HorizontalCategoryAxisBead; HorizontalCategoryAxisBead;
+ import org.apache.flex.charts.beads.HorizontalLinearAxisBead; HorizontalLinearAxisBead;
+ import org.apache.flex.charts.beads.VerticalCategoryAxisBead; VerticalCategoryAxisBead;
+ import org.apache.flex.charts.beads.VerticalLinearAxisBead; VerticalLinearAxisBead;
+ import org.apache.flex.charts.beads.layouts.BarChartLayout; BarChartLayout;
+ import org.apache.flex.charts.beads.layouts.ColumnChartLayout; ColumnChartLayout;
+ import org.apache.flex.charts.beads.layouts.LineChartCategoryVsLinearLayout; LineChartCategoryVsLinearLayout;
+ import org.apache.flex.charts.beads.layouts.LineChartLinearVsLinearLayout; LineChartLinearVsLinearLayout;
+ import org.apache.flex.charts.beads.layouts.PieChartLayout; PieChartLayout;
+ import org.apache.flex.charts.beads.layouts.StackedBarChartLayout; StackedBarChartLayout;
+ import org.apache.flex.charts.beads.layouts.StackedColumnChartLayout; StackedColumnChartLayout;
+ import org.apache.flex.charts.supportClasses.BarSeries; BarSeries;
+ import org.apache.flex.charts.supportClasses.LineSeries; LineSeries;
+ import org.apache.flex.charts.supportClasses.PieSeries; PieSeries;
+ import org.apache.flex.charts.supportClasses.BoxItemRenderer; BoxItemRenderer;
+ import org.apache.flex.charts.supportClasses.LineSegmentItemRenderer; LineSegmentItemRenderer;
+ import org.apache.flex.charts.supportClasses.WedgeItemRenderer; WedgeItemRenderer;
+ import org.apache.flex.charts.optimized.SVGChartAxisGroup; SVGChartAxisGroup;
+ import org.apache.flex.charts.optimized.SVGChartDataGroup; SVGChartDataGroup;
+ import org.apache.flex.charts.optimized.SVGBoxItemRenderer; SVGBoxItemRenderer;
+ import org.apache.flex.charts.optimized.SVGWedgeItemRenderer; SVGWedgeItemRenderer;
+ import org.apache.flex.charts.optimized.SVGLineSegmentItemRenderer; SVGLineSegmentItemRenderer;
}
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/BarChart.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/BarChart.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/BarChart.as
new file mode 100644
index 0000000..4065dd3
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/BarChart.as
@@ -0,0 +1,49 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts
+{
+ import org.apache.flex.charts.core.ChartBase;
+ import org.apache.flex.charts.core.IChart;
+
+ /**
+ * The BarChart class draws a multi-series graph of data using vertical
+ * columns. The series property is an array of BarChartSeries instances
+ * that represent the data in the model.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class BarChart extends ChartBase implements IChart
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function BarChart()
+ {
+ super();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/ColumnChart.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/ColumnChart.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/ColumnChart.as
new file mode 100644
index 0000000..c9010b8
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/ColumnChart.as
@@ -0,0 +1,48 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts
+{
+ import org.apache.flex.charts.core.ChartBase;
+ import org.apache.flex.charts.core.IChart;
+
+ /**
+ * The ColumnChart displays a histogram chart where each series in
+ * in the chart is a vertical column placed side by side.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ColumnChart extends ChartBase implements IChart
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ColumnChart()
+ {
+ super();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/LineChart.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/LineChart.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/LineChart.as
new file mode 100644
index 0000000..27ba0a5
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/LineChart.as
@@ -0,0 +1,48 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts
+{
+ import org.apache.flex.charts.core.ChartBase;
+ import org.apache.flex.charts.core.IChart;
+
+ /**
+ * The LineChart displays a series of line graphs with optional
+ * graphics at each vertex.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class LineChart extends ChartBase implements IChart
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function LineChart()
+ {
+ super();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/PieChart.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/PieChart.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/PieChart.as
new file mode 100644
index 0000000..591e2d7
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/PieChart.as
@@ -0,0 +1,47 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts
+{
+ import org.apache.flex.charts.core.ChartBase;
+ import org.apache.flex.charts.core.IChart;
+
+ /**
+ * The PieChart displays data as a percentage of pie.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class PieChart extends ChartBase implements IChart
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function PieChart()
+ {
+ super();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/StackedBarChart.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/StackedBarChart.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/StackedBarChart.as
new file mode 100644
index 0000000..415b176
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/StackedBarChart.as
@@ -0,0 +1,48 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts
+{
+ import org.apache.flex.charts.core.ChartBase;
+ import org.apache.flex.charts.core.IChart;
+
+ /**
+ * The StackedBarChart displays a histogram chart where each series in
+ * the chart is stack next to each other.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class StackedBarChart extends ChartBase implements IChart
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function StackedBarChart()
+ {
+ super();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/StackedColumnChart.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/StackedColumnChart.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/StackedColumnChart.as
new file mode 100644
index 0000000..ab9ae2d
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/StackedColumnChart.as
@@ -0,0 +1,48 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts
+{
+ import org.apache.flex.charts.core.ChartBase;
+ import org.apache.flex.charts.core.IChart;
+
+ /**
+ * The StackedColumnChart displays a histogram chart where each series in
+ * the chart is stack on top of each other.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class StackedColumnChart extends ChartBase implements IChart
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function StackedColumnChart()
+ {
+ super();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/AxisBaseBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/AxisBaseBead.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/AxisBaseBead.as
new file mode 100644
index 0000000..9383f14
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/AxisBaseBead.as
@@ -0,0 +1,246 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts.beads
+{
+ import org.apache.flex.charts.core.IAxisBead;
+ import org.apache.flex.charts.core.IAxisGroup;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.graphics.GraphicsContainer;
+ import org.apache.flex.core.graphics.IFill;
+ import org.apache.flex.core.graphics.IStroke;
+ import org.apache.flex.core.graphics.SolidColor;
+ import org.apache.flex.core.graphics.SolidColorStroke;
+
+ /**
+ * The AxisBaseBead is the base class for the chart axis beads.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class AxisBaseBead implements IAxisBead
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function AxisBaseBead()
+ {
+ // create default dark stroke for the axis line and tick marks
+ // in case they are not set otherwise.
+
+ var blackLine:SolidColorStroke = new SolidColorStroke();
+ blackLine.color = 0x111111;
+ blackLine.weight = 1;
+ blackLine.alpha = 1.0;
+
+ axisStroke = blackLine;
+ tickStroke = blackLine;
+
+ var blackFill:SolidColor = new SolidColor();
+ blackFill.color = 0x111111;
+ blackFill.alpha = 1.0;
+
+ tickFill = blackFill;
+ }
+
+ private var _strand:IStrand;
+ private var wrapper:GraphicsContainer;
+ private var _axisGroup:IAxisGroup;
+
+ private var _placement:String = "unset";
+ private var _axisStroke:IStroke;
+ private var _tickStroke:IStroke;
+ private var _tickFill:IFill;
+
+ private var tickPathString:String = null;
+ private var tickMaxWidth:Number = 0;
+ private var tickMaxHeight:Number = 0;
+
+ /**
+ * The placement of the axis with respect to the chart area. Valid
+ * values are: top, bottom (for IHorizontalAxisBeads), left, and right
+ * (for IVerticalAxisBeads).
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get placement():String
+ {
+ return _placement;
+ }
+ public function set placement(value:String):void
+ {
+ _placement = value;
+ }
+
+ /**
+ * The stroke used to draw the line for the axis.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get axisStroke():IStroke
+ {
+ return _axisStroke;
+ }
+ public function set axisStroke(value:IStroke):void
+ {
+ _axisStroke = value;
+ }
+
+ /**
+ * The stroke used to draw each tick mark.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get tickStroke():IStroke
+ {
+ return _tickStroke;
+ }
+ public function set tickStroke(value:IStroke):void
+ {
+ _tickStroke = value;
+ }
+
+ /**
+ * The stroke used to draw each tick label.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get tickFill():IFill
+ {
+ return _tickFill;
+ }
+ public function set tickFill(value:IFill):void
+ {
+ _tickFill = value;
+ }
+
+ /**
+ * The container space for lines, tick marks, etc.
+ */
+ public function get axisGroup():IAxisGroup
+ {
+ return _axisGroup;
+ }
+ public function set axisGroup(value:IAxisGroup):void
+ {
+ _axisGroup = value;
+
+ wrapper = new GraphicsContainer();
+ UIBase(_axisGroup).addElement(wrapper);
+ wrapper.x = 0;
+ wrapper.y = 0;
+ wrapper.width = UIBase(_axisGroup).width;
+ wrapper.height = UIBase(_axisGroup).height;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ }
+ public function get strand():IStrand
+ {
+ return _strand;
+ }
+
+ /**
+ * Removes all graphic elements.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected function clearGraphics():void
+ {
+ axisGroup.removeAllElements();
+ }
+
+ /**
+ * @private
+ */
+ protected function drawAxisPath(originX:Number, originY:Number, xoffset:Number, yoffset:Number):void
+ {
+ axisGroup.drawAxisLine(originX, originY, xoffset, yoffset, axisStroke);
+ }
+
+ /**
+ * @private
+ */
+ protected function addTickLabel(text:String, xpos:Number, ypos:Number, boxWidth:Number, boxHeight:Number):Object
+ {
+ var isHorizontal:Boolean = (placement == "bottom") || (placement == "top");
+
+ var label:Object;
+
+ if (isHorizontal) label = axisGroup.drawHorizontalTickLabel(text, xpos, ypos, boxWidth, boxHeight, tickFill);
+ else label = axisGroup.drawVerticalTickLabel(text, xpos, ypos, boxWidth, boxHeight, tickFill);
+
+ return label;
+ }
+
+ /**
+ * @private
+ */
+ protected function addTickMark(xpos:Number, ypos:Number, xoffset:Number, yoffset:Number):void
+ {
+ if (tickPathString == null) tickPathString = "";
+ tickPathString = tickPathString + " M "+String(xpos)+" "+String(ypos);
+ tickPathString = tickPathString + " l " + String(xoffset)+" "+String(yoffset);
+
+ tickMaxWidth = Math.max(tickMaxWidth, xpos+xoffset);
+ tickMaxHeight= Math.max(tickMaxHeight, ypos+yoffset);
+ }
+
+ /**
+ * @private
+ */
+ protected function drawTickPath(originX:Number, originY:Number):void
+ {
+ axisGroup.drawTickMarks(originX, originY, tickMaxWidth, tickMaxHeight, tickPathString, tickStroke);
+ tickPathString = null;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/ChartItemRendererFactory.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/ChartItemRendererFactory.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/ChartItemRendererFactory.as
new file mode 100644
index 0000000..a291365
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/ChartItemRendererFactory.as
@@ -0,0 +1,155 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts.beads
+{
+ import org.apache.flex.charts.core.IChart;
+ import org.apache.flex.charts.core.IChartItemRenderer;
+ import org.apache.flex.charts.core.IChartSeries;
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IDataProviderItemRendererMapper;
+ import org.apache.flex.core.IItemRendererClassFactory;
+ import org.apache.flex.core.IItemRendererParent;
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.html.beads.IListView;
+
+ /**
+ * The ChartItemRendererFactory class implements IDataProviderItemRendererMapper
+ * and creats the itemRenderers for each series in a chart. The itemRenderer class
+ * is identified on each series either through a property or through a CSS style.
+ * Once all of the itemRenderers are created, an itemsCreated event is dispatched
+ * causing the layout associated with the chart to size and position the items.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ChartItemRendererFactory implements IBead, IDataProviderItemRendererMapper
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ChartItemRendererFactory()
+ {
+ }
+
+ private var selectionModel:ISelectionModel;
+ protected var dataGroup:IItemRendererParent;
+
+ private var _seriesRenderers:Array;
+
+ /**
+ * The array of renderers created for each series.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get seriesRenderers():Array
+ {
+ return _seriesRenderers;
+ }
+ public function set seriesRenderers(value:Array):void
+ {
+ _seriesRenderers = value;
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ selectionModel = value.getBeadByType(ISelectionModel) as ISelectionModel;
+ var listView:IListView = value.getBeadByType(IListView) as IListView;
+ dataGroup = listView.dataGroup;
+ // selectionModel.addEventListener("dataProviderChanged", dataProviderChangeHandler);
+
+ var dp:Array = selectionModel.dataProvider as Array;
+ if (!dp)
+ return;
+
+ _seriesRenderers = new Array();
+
+ dataGroup.removeAllElements();
+
+ var series:Array = IChart(_strand).series;
+
+ for( var j:int=0; j < dp.length; j++)
+ {
+ var renderers:Array = new Array();
+
+ for( var i:int=0; i < series.length; i++)
+ {
+ var s:IChartSeries = series[i] as IChartSeries;
+ var k:IChartItemRenderer = s.itemRenderer.newInstance() as IChartItemRenderer;
+ k.itemRendererParent = dataGroup;
+ k.xField = s.xField;
+ k.yField = s.yField;
+ //k.fillColor = s.fillColor;
+ k.data = dp[j];
+ //k.index = j;
+
+ renderers.push(k);
+
+ dataGroup.addElement(k);
+ }
+
+ _seriesRenderers.push(renderers);
+ }
+
+ IEventDispatcher(_strand).dispatchEvent(new Event("itemsCreated"));
+ }
+ public function get strand():IStrand
+ {
+ return _strand;
+ }
+
+ /**
+ * @private
+ */
+ public function get itemRendererFactory():IItemRendererClassFactory
+ {
+ return null;
+ }
+
+ /**
+ * @private
+ */
+ public function set itemRendererFactory(value:IItemRendererClassFactory):void
+ {
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/ChartView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/ChartView.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/ChartView.as
new file mode 100644
index 0000000..6f5c446
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/ChartView.as
@@ -0,0 +1,175 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts.beads
+{
+ import org.apache.flex.charts.core.IAxisGroup;
+ import org.apache.flex.charts.core.IHorizontalAxisBead;
+ import org.apache.flex.charts.core.IVerticalAxisBead;
+ import org.apache.flex.core.IBeadLayout;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IParent;
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IViewport;
+ import org.apache.flex.core.IViewportModel;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.geom.Rectangle;
+ import org.apache.flex.geom.Size;
+ import org.apache.flex.html.beads.ListView;
+ import org.apache.flex.html.beads.models.ViewportModel;
+ import org.apache.flex.html.supportClasses.Viewport;
+ import org.apache.flex.utils.CSSContainerUtils;
+
+ public class ChartView extends ListView implements IBeadView
+ {
+ public function ChartView()
+ {
+ super();
+ }
+
+ private var _strand:IStrand;
+ private var _horizontalAxisGroup:IAxisGroup;
+ private var _verticalAxisGroup:IAxisGroup;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ _strand = value;
+
+ var listModel:ISelectionModel = _strand.getBeadByType(ISelectionModel) as ISelectionModel;
+ listModel.addEventListener("dataProviderChanged", dataProviderChangeHandler);
+
+ var haxis:IHorizontalAxisBead = _strand.getBeadByType(IHorizontalAxisBead) as IHorizontalAxisBead;
+ if (haxis && _horizontalAxisGroup == null) {
+ var m1:Class = ValuesManager.valuesImpl.getValue(_strand, "iHorizontalAxisGroup");
+ _horizontalAxisGroup = new m1();
+ haxis.axisGroup = _horizontalAxisGroup;
+ IParent(_strand).addElement(_horizontalAxisGroup, false);
+ }
+
+ var vaxis:IVerticalAxisBead = _strand.getBeadByType(IVerticalAxisBead) as IVerticalAxisBead;
+ if (vaxis && _verticalAxisGroup == null) {
+ var m2:Class = ValuesManager.valuesImpl.getValue(_strand, "iVerticalAxisGroup");
+ _verticalAxisGroup = new m2();
+ vaxis.axisGroup = _verticalAxisGroup;
+ IParent(_strand).addElement(_verticalAxisGroup, false);
+ }
+
+ super.strand = value;
+ }
+
+ override protected function completeSetup():void
+ {
+ if (border) {
+ IParent(_strand).removeElement(border);
+ }
+
+ super.completeSetup();
+ }
+
+ public function get horizontalAxisGroup():IAxisGroup
+ {
+ return _horizontalAxisGroup;
+ }
+
+ public function get verticalAxisGroup():IAxisGroup
+ {
+ return _verticalAxisGroup;
+ }
+
+ /**
+ * @private
+ */
+ override protected function dataProviderChangeHandler(event:Event):void
+ {
+ if (verticalAxisGroup) {
+ verticalAxisGroup.removeAllElements();
+ }
+
+ if (horizontalAxisGroup) {
+ horizontalAxisGroup.removeAllElements();
+ }
+
+ dataGroup.removeAllElements();
+ }
+
+ /**
+ * ChartView overrides performLayout so that the exact area of the ChartDataGroup can
+ * be calculated so the chart's layout algorithm knows precisely the dimensions of
+ * chart for its item renderers.
+ */
+ override protected function layoutViewBeforeContentLayout():void
+ {
+ var metrics:Rectangle = CSSContainerUtils.getBorderAndPaddingMetrics(_strand);
+
+ var widthAdjustment:Number = 0;
+ var heightAdjustment:Number = 0;
+
+ var vaxis:IVerticalAxisBead = _strand.getBeadByType(IVerticalAxisBead) as IVerticalAxisBead;
+ var haxis:IHorizontalAxisBead = _strand.getBeadByType(IHorizontalAxisBead) as IHorizontalAxisBead;
+
+ if (vaxis) {
+ widthAdjustment = vaxis.axisWidth;
+ }
+
+ if (haxis) {
+ heightAdjustment = haxis.axisHeight;
+ }
+
+ var strandWidth:Number = UIBase(_strand).width;
+ var strandHeight:Number = UIBase(_strand).height;
+
+ viewport.setPosition(widthAdjustment + metrics.left, metrics.top);
+ viewport.layoutViewportBeforeContentLayout(strandWidth - widthAdjustment - metrics.right - metrics.left,
+ strandHeight - heightAdjustment - metrics.bottom - metrics.top);
+
+ if (verticalAxisGroup) {
+ UIBase(verticalAxisGroup).x = metrics.left;
+ UIBase(verticalAxisGroup).y = metrics.top;
+ UIBase(verticalAxisGroup).width = widthAdjustment;
+ UIBase(verticalAxisGroup).height = strandHeight - heightAdjustment - metrics.bottom - metrics.top;
+ }
+
+ if (horizontalAxisGroup) {
+ UIBase(horizontalAxisGroup).x = widthAdjustment + metrics.left;
+ UIBase(horizontalAxisGroup).y = strandHeight - heightAdjustment - metrics.bottom;
+ UIBase(horizontalAxisGroup).width = strandWidth - widthAdjustment - metrics.left - metrics.right;
+ UIBase(horizontalAxisGroup).height = heightAdjustment;
+ }
+
+ /* viewport should be doing this now
+ if (dataGroup) {
+ UIBase(dataGroup).x = viewportModel.contentX;
+ UIBase(dataGroup).y = viewportModel.contentY;
+ UIBase(dataGroup).width = viewportModel.contentWidth;
+ UIBase(dataGroup).height = viewportModel.contentHeight;
+ } */
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/DataItemRendererFactoryForSeriesData.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/DataItemRendererFactoryForSeriesData.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/DataItemRendererFactoryForSeriesData.as
new file mode 100644
index 0000000..f6c7562
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/DataItemRendererFactoryForSeriesData.as
@@ -0,0 +1,131 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts.beads
+{
+ import org.apache.flex.charts.core.IChart;
+ import org.apache.flex.charts.core.IChartDataGroup;
+ import org.apache.flex.charts.core.IChartItemRenderer;
+ import org.apache.flex.charts.core.IChartSeries;
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IDataProviderItemRendererMapper;
+ import org.apache.flex.core.IItemRendererClassFactory;
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.html.beads.IListView;
+
+ /**
+ * The DataItemRendererFactoryForSeriesData creates the itemRenderers necessary for series-based
+ * charts.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DataItemRendererFactoryForSeriesData implements IBead, IDataProviderItemRendererMapper
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DataItemRendererFactoryForSeriesData()
+ {
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ var selectionModel:ISelectionModel = value.getBeadByType(ISelectionModel) as ISelectionModel;
+ selectionModel.addEventListener("dataProviderChanged", dataProviderChangeHandler);
+
+ dataProviderChangeHandler(null);
+ }
+ public function get strand():IStrand
+ {
+ return _strand;
+ }
+
+ /**
+ * For series data, the 'global' itemRendererFactory is not used. Each series supplies
+ * its own itemRendererFactory.
+ */
+ public function get itemRendererFactory():IItemRendererClassFactory
+ {
+ return null;
+ }
+ public function set itemRendererFactory(value:IItemRendererClassFactory):void
+ {
+ }
+
+ /**
+ * @private
+ */
+ private function dataProviderChangeHandler(event:Event):void
+ {
+ var selectionModel:ISelectionModel = _strand.getBeadByType(ISelectionModel) as ISelectionModel;
+ var dp:Array = selectionModel.dataProvider as Array;
+ if (!dp)
+ return;
+
+ var listView:IListView = _strand.getBeadByType(IListView) as IListView;
+ var dataGroup:IChartDataGroup = listView.dataGroup as IChartDataGroup;
+ dataGroup.removeAllElements();
+
+ var chart:IChart = _strand as IChart;
+ var series:Array = chart.series;
+
+ for (var s:int=0; s < series.length; s++)
+ {
+ var n:int = dp.length;
+ var chartSeries:IChartSeries = series[s] as IChartSeries;
+
+ for (var i:int = 0; i < n; i++)
+ {
+ if (chartSeries.itemRenderer)
+ {
+ var ir:IChartItemRenderer = chartSeries.itemRenderer.newInstance() as IChartItemRenderer;
+ dataGroup.addElement(ir);
+ ir.itemRendererParent = dataGroup;
+ ir.data = dp[i];
+ ir.series = chartSeries;
+ }
+ }
+
+ }
+
+ IEventDispatcher(_strand).dispatchEvent(new Event("itemsCreated"));
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/DataTipBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/DataTipBead.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/DataTipBead.as
new file mode 100644
index 0000000..559a7b9
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/DataTipBead.as
@@ -0,0 +1,162 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts.beads
+{
+ import org.apache.flex.charts.core.IChartDataGroup;
+ import org.apache.flex.charts.core.IChartItemRenderer;
+ import org.apache.flex.charts.core.IChartSeries;
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.events.MouseEvent;
+ import org.apache.flex.events.utils.MouseUtils;
+ import org.apache.flex.geom.Point;
+ import org.apache.flex.html.accessories.ToolTipBead;
+ import org.apache.flex.html.beads.IListView;
+ import org.apache.flex.utils.PointUtils;
+
+ /**
+ * The DataTipBead can be added to a chart to produce a helpful tip when the
+ * moves over an itemRenderer.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DataTipBead extends ToolTipBead implements IBead
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DataTipBead()
+ {
+ }
+
+ private var _strand:IStrand;
+
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+ _strand = value;
+
+ IEventDispatcher(_strand).addEventListener("viewCreated", handleViewCreated);
+ }
+
+ private var _labelFunction:Function;
+
+ /**
+ * An optional function that can format the data tip text.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get labelFunction():Function
+ {
+ return _labelFunction;
+ }
+ public function set labelFunction(value:Function):void
+ {
+ _labelFunction = value;
+ }
+
+ /**
+ * @private
+ */
+ private function handleViewCreated( event:Event ):void
+ {
+ // find the data group
+ var chart:IListView = _strand.getBeadByType(IListView) as IListView;
+ var dataGroup:IChartDataGroup = chart.dataGroup as IChartDataGroup;
+ IEventDispatcher(dataGroup).addEventListener(MouseEvent.MOUSE_OVER, rollOverHandler);
+ }
+
+ /**
+ * @private
+ * Overrides the ToolTipBead's function to determine the text to display
+ * based on the chart series and current value.
+ */
+ override protected function rollOverHandler( event:MouseEvent ):void
+ {
+ var renderer:IChartItemRenderer = findItemRenderer(event);
+ if (renderer)
+ {
+ var series:IChartSeries = renderer.series;
+ var result:String;
+
+ if (labelFunction) {
+ result = labelFunction(renderer);
+ }
+ else {
+ if (series.xField) result = renderer.data[series.xField];
+ else if (series.yField) result = renderer.data[series.yField];
+ }
+ this.toolTip = result;
+
+ super.rollOverHandler(event);
+ }
+ }
+
+ /**
+ * @private
+ * Override's the ToolTipBead's function to position the data tip just above
+ * the itemRenderer.
+ */
+ override protected function determinePosition(event:MouseEvent, base:Object):Point
+ {
+ // always want above the renderer
+ var pt:Point = new Point(0, -20);
+ pt = PointUtils.localToGlobal(pt, base);
+ return pt;
+ }
+
+ /**
+ * @private
+ */
+ private function findItemRenderer(event:MouseEvent):IChartItemRenderer
+ {
+ var base:Object = MouseUtils.eventTarget(event);
+
+ if (base is IChartDataGroup)
+ {
+ var dataGroup:IChartDataGroup = base as IChartDataGroup;
+ var point:Point = new Point(event.localX, event.localY);
+ var renderer:IChartItemRenderer = dataGroup.getItemRendererUnderPoint(point);
+ return renderer;
+ }
+ else
+ {
+ var chain:UIBase = base as UIBase;
+ while (chain != null && !(chain is IChartItemRenderer)) {
+ chain = chain.parent as UIBase;
+ }
+ return chain as IChartItemRenderer;
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/HorizontalCategoryAxisBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/HorizontalCategoryAxisBead.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/HorizontalCategoryAxisBead.as
new file mode 100644
index 0000000..0adcb2c
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/HorizontalCategoryAxisBead.as
@@ -0,0 +1,191 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts.beads
+{
+ import org.apache.flex.charts.core.IHorizontalAxisBead;
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.html.beads.models.ArraySelectionModel;
+
+ /**
+ * The HorizontalCategoryAxisBead displays a horizontal axis with
+ * tick marks corresponding to data points identified by the
+ * categoryField property. This type of axis is useful for non-numeric
+ * plots.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class HorizontalCategoryAxisBead extends AxisBaseBead implements IBead, IHorizontalAxisBead
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function HorizontalCategoryAxisBead()
+ {
+ super();
+
+ placement = "bottom";
+ }
+
+ private var _axisHeight:Number = 30;
+
+ /**
+ * The height of the horizontal axis.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get axisHeight():Number
+ {
+ return _axisHeight;
+ }
+ public function set axisHeight(value:Number):void
+ {
+ _axisHeight = value;
+ }
+
+ private var _categoryField:String;
+
+ /**
+ * The name of field within the chart data to used to categorize each of the
+ * axis data points.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get categoryField():String
+ {
+ return _categoryField;
+ }
+ public function set categoryField(value:String):void
+ {
+ _categoryField = value;
+ }
+
+ private var _gap:Number = 20;
+
+ /**
+ * The amount of space to leave between series. If a chart has several series,
+ * the bars for an X value are side by side with a gap between the groups of
+ * bars. The default is 20.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get gap():Number
+ {
+ return _gap;
+ }
+ public function set gap(value:Number):void
+ {
+ _gap = value;
+ }
+
+ /**
+ * @private
+ */
+ public function get maximum():Number
+ {
+ return Number.NaN;
+ }
+
+ /**
+ * @private
+ */
+ public function get minimum():Number
+ {
+ return 0;
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ super.strand = value;
+
+ // in order to draw or create the labels, need to know when the series has been created.
+ IEventDispatcher(value).addEventListener("layoutComplete",handleItemsCreated);
+ }
+ override public function get strand():IStrand
+ {
+ return _strand;
+ }
+
+ /**
+ * @private
+ */
+ private function handleItemsCreated(event:Event):void
+ {
+ var model:ArraySelectionModel = strand.getBeadByType(ISelectionModel) as ArraySelectionModel;
+ var items:Array;
+ if (model.dataProvider is Array) items = model.dataProvider as Array;
+ else return;
+
+ clearGraphics();
+
+ var xpos:Number = 0;
+ var useWidth:Number = UIBase(axisGroup).width;
+
+ // place the labels below the axis enough to account for the tick marks
+ var labelY:Number = 7;
+ var itemWidth:Number = (useWidth - gap*(items.length-1))/items.length;
+
+ for(var i:int=0; i < items.length; i++)
+ {
+ addTickLabel(items[i][categoryField], xpos, labelY, itemWidth, 0);
+
+ // add a tick mark, too
+ addTickMark(xpos + itemWidth/2, 0, 0, 5);
+
+ xpos += itemWidth + gap;
+ }
+
+ // draw the axis and the tick marks
+ drawAxisPath(0, 0, useWidth, 1);
+ drawTickPath(0, 1);
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/HorizontalLinearAxisBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/HorizontalLinearAxisBead.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/HorizontalLinearAxisBead.as
new file mode 100644
index 0000000..a96fb2d
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/HorizontalLinearAxisBead.as
@@ -0,0 +1,246 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts.beads
+{
+ import org.apache.flex.charts.core.IChart;
+ import org.apache.flex.charts.core.IHorizontalAxisBead;
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.html.beads.models.ArraySelectionModel;
+
+ /**
+ * The HorizontalLinearAxisBead class provides a horizontal axis that uses a numeric
+ * range.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class HorizontalLinearAxisBead extends AxisBaseBead implements IBead, IHorizontalAxisBead
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function HorizontalLinearAxisBead()
+ {
+ super();
+
+ placement = "bottom";
+ }
+
+ private var _axisHeight:Number = 30;
+
+ /**
+ * The height of the horizontal axis.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get axisHeight():Number
+ {
+ return _axisHeight;
+ }
+ public function set axisHeight(value:Number):void
+ {
+ _axisHeight = value;
+ }
+
+ private var _valueField:String;
+
+ /**
+ * The name of field within the chart data the holds the value being mapped
+ * to this axis. If values should fall within minimum and maximum but if
+ * not, they will be fixed to the closest value.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get valueField():String
+ {
+ return _valueField;
+ }
+ public function set valueField(value:String):void
+ {
+ _valueField = value;
+ }
+
+ private var _minimum:Number = 0;
+
+ /**
+ * The minimun value to be represented on this axis. If minimum is NaN,
+ * the value is calculated from the data.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get minimum():Number
+ {
+ return _minimum;
+ }
+ public function set minimum(value:Number):void
+ {
+ _minimum = value;
+ }
+
+ private var _maximum:Number = Number.NaN;
+
+ /**
+ * The maximum value to be represented on this axis. If maximum is NaN,
+ * the value is calculated from the data.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get maximum():Number
+ {
+ return _maximum;
+ }
+ public function set maximum(value:Number):void
+ {
+ _maximum = value;
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ super.strand = value;
+
+ // in order to draw or create the labels, need to know when the series has been created.
+ IEventDispatcher(strand).addEventListener("layoutComplete",handleItemsCreated);
+ }
+ override public function get strand():IStrand
+ {
+ return _strand;
+ }
+
+ /**
+ * @private
+ */
+ private function formatLabel(n:Number):String
+ {
+ var sign:Number = n < 0 ? -1 : 1;
+ n = Math.abs(n);
+
+ var i:int;
+
+ if (0 <= n && n <= 1) {
+ i = Math.round(n * 100);
+ n = i / 100.0;
+ }
+ else {
+ i = Math.round(n);
+ n = i;
+ }
+
+ var result:String = String(sign*n);
+ return result;
+ }
+
+ /**
+ * @private
+ */
+ private function handleItemsCreated(event:Event):void
+ {
+ var model:ArraySelectionModel = strand.getBeadByType(ISelectionModel) as ArraySelectionModel;
+ var items:Array;
+ if (model.dataProvider is Array) items = model.dataProvider as Array;
+ else return;
+
+ clearGraphics();
+
+ var xpos:Number = 0;
+ var useWidth:Number = UIBase(axisGroup).width;
+ var series:Array = IChart(strand).series;
+ var maxValue:Number = Number.MIN_VALUE;
+ var minValue:Number = Number.MAX_VALUE;
+
+ // determine minimum and maximum values, if needed
+ if (isNaN(minimum)) {
+ for(var i:int=0; i < items.length; i++) {
+ var value:Number = Number(items[i][valueField]);
+ if (!isNaN(value)) minValue = Math.min(minValue,value);
+ else minValue = Math.min(minValue,0);
+ }
+ } else {
+ minValue = minimum;
+ }
+ if (isNaN(maximum)) {
+ for(i=0; i < items.length; i++) {
+ value = Number(items[i][valueField]);
+ if (!isNaN(value)) maxValue = Math.max(maxValue,value);
+ else maxValue = Math.max(maxValue,0);
+ }
+ } else {
+ maxValue = maximum;
+ }
+
+ var numTicks:Number = 10; // should determine this some other way, I think
+ var tickStep:Number = (maxValue - minValue)/numTicks;
+ var tickSpacing:Number = useWidth/numTicks;
+ var tickValue:Number = minValue;
+
+ // place the labels below the axis enough to account for the tick marks
+ var labelY:Number = 7;
+
+ for(i=0; i < numTicks+1; i++)
+ {
+ var label:Object = addTickLabel(formatLabel(tickValue), xpos, labelY, tickSpacing, 0);
+ label.x = xpos - label.width/2;
+
+ // add a tick mark, too
+ addTickMark(xpos, 0, 0, 5);
+
+ xpos += tickSpacing;
+ tickValue += tickStep;
+ }
+
+ // draw the axis and tick marks
+ drawAxisPath(0, 0, useWidth, 0);
+ drawTickPath(0, 1);
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/VerticalCategoryAxisBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/VerticalCategoryAxisBead.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/VerticalCategoryAxisBead.as
new file mode 100644
index 0000000..d89819d
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/VerticalCategoryAxisBead.as
@@ -0,0 +1,198 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts.beads
+{
+ import org.apache.flex.charts.core.IChart;
+ import org.apache.flex.charts.core.IVerticalAxisBead;
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.html.beads.models.ArraySelectionModel;
+
+ /**
+ * The VerticalCategoryAxisBead displays a vertical axis with
+ * tick marks corresponding to data points identified by the
+ * categoryField property. This type of axis is useful for non-numeric
+ * plots.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class VerticalCategoryAxisBead extends AxisBaseBead implements IBead, IVerticalAxisBead
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function VerticalCategoryAxisBead()
+ {
+ super();
+
+ placement = "left";
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ super.strand = value;
+
+ // in order to draw or create the labels, need to know when the series has been created.
+ IEventDispatcher(strand).addEventListener("layoutComplete",handleItemsCreated);
+ }
+ override public function get strand():IStrand
+ {
+ return _strand;
+ }
+
+ private var _categoryField:String;
+
+ /**
+ * The name of field within the chart data to used to categorize each of the
+ * axis data points.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get categoryField():String
+ {
+ return _categoryField;
+ }
+ public function set categoryField(value:String):void
+ {
+ _categoryField = value;
+ }
+
+ private var _axisWidth:Number = 100;
+
+ /**
+ * The overall width of the axis.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get axisWidth():Number
+ {
+ return _axisWidth;
+ }
+
+ public function set axisWidth(value:Number):void
+ {
+ _axisWidth = value;
+ }
+
+ private var _gap:Number = 20;
+
+ /**
+ * The amount of space to leave between series. If a chart has several series,
+ * the bars for an X value are side by side with a gap between the groups of
+ * bars.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get gap():Number
+ {
+ return _gap;
+ }
+ public function set gap(value:Number):void
+ {
+ _gap = value;
+ }
+
+ /**
+ * @private
+ */
+ public function get maximum():Number
+ {
+ return Number.NaN;
+ }
+
+ /**
+ * @private
+ */
+ public function get minimum():Number
+ {
+ return 0;
+ }
+
+ /**
+ * @private
+ */
+ private function handleItemsCreated(event:Event):void
+ {
+ var model:ArraySelectionModel = strand.getBeadByType(ISelectionModel) as ArraySelectionModel;
+ var items:Array;
+ if (model.dataProvider is Array) items = model.dataProvider as Array;
+ else return;
+
+ clearGraphics();
+
+ var series:Array = IChart(strand).series;
+
+ var useHeight:Number = UIBase(axisGroup).height;
+ var useWidth:Number = UIBase(axisGroup).width;
+ var itemHeight:Number = (useHeight - gap*(items.length-1)) / items.length;
+ var xpos:Number = 0;
+ var ypos:Number = useHeight - itemHeight/2;
+
+ var numTicks:Number = items.length;
+ var tickSpacing:Number = itemHeight + gap;
+
+ for(var i:int=0; i < items.length; i++)
+ {
+ var label:Object = addTickLabel(items[i][categoryField], 0, ypos, 0, itemHeight);
+ label.y = ypos - label.height/2;
+
+ // add a tick mark, too.
+ addTickMark(useWidth-6, ypos, 5, 0);
+
+ ypos -= tickSpacing;
+ }
+
+ // draw the axis and tick marks
+ drawAxisPath(useWidth-1, 0, 0, useHeight);
+ drawTickPath(useWidth-6, 0);
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/VerticalLinearAxisBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/VerticalLinearAxisBead.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/VerticalLinearAxisBead.as
new file mode 100644
index 0000000..823da8d
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/VerticalLinearAxisBead.as
@@ -0,0 +1,236 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts.beads
+{
+ import org.apache.flex.charts.core.IChart;
+ import org.apache.flex.charts.core.IVerticalAxisBead;
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.html.beads.models.ArraySelectionModel;
+
+ /**
+ * The VerticalLinearAxisBead class provides a vertical axis that uses a numeric
+ * range.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class VerticalLinearAxisBead extends AxisBaseBead implements IBead, IVerticalAxisBead
+ {
+ public function VerticalLinearAxisBead()
+ {
+ super();
+
+ placement = "left";
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ super.strand = value;
+
+ // in order to draw or create the labels, need to know when the series has been created.
+ IEventDispatcher(strand).addEventListener("layoutComplete",handleItemsCreated);
+ }
+ override public function get strand():IStrand
+ {
+ return _strand;
+ }
+
+ private var _axisWidth:Number = 50;
+
+ public function get axisWidth():Number
+ {
+ return _axisWidth;
+ }
+ public function set axisWidth(value:Number):void
+ {
+ _axisWidth = value;
+ }
+
+ private var _valueField:String;
+
+ /**
+ * The name of field within the chart data the holds the value being mapped
+ * to this axis. If values should fall within minimum and maximum but if
+ * not, they will be fixed to the closest value.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get valueField():String
+ {
+ return _valueField;
+ }
+ public function set valueField(value:String):void
+ {
+ _valueField = value;
+ }
+
+ private var _minimum:Number = 0;
+
+ /**
+ * The minimun value to be represented on this axis. If minimum is NaN,
+ * the value is calculated from the data.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get minimum():Number
+ {
+ return _minimum;
+ }
+ public function set minimum(value:Number):void
+ {
+ _minimum = value;
+ }
+
+ private var _maximum:Number = Number.NaN;
+
+ /**
+ * The maximum value to be represented on this axis. If maximum is NaN,
+ * the value is calculated from the data.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get maximum():Number
+ {
+ return _maximum;
+ }
+ public function set maximum(value:Number):void
+ {
+ _maximum = value;
+ }
+
+ /**
+ * @private
+ */
+ private function formatLabel(n:Number):String
+ {
+ var sign:Number = n < 0 ? -1 : 1;
+ n = Math.abs(n);
+
+ var i:int;
+
+ if (0 <= n && n <= 1) {
+ i = Math.round(n * 100);
+ n = i / 100.0;
+ }
+ else {
+ i = Math.round(n);
+ n = i;
+ }
+
+ var result:String = String(sign*n);
+ return result;
+ }
+
+ /**
+ * @private
+ */
+ private function handleItemsCreated(event:Event):void
+ {
+ var model:ArraySelectionModel = strand.getBeadByType(ISelectionModel) as ArraySelectionModel;
+ var items:Array;
+ if (model.dataProvider is Array) items = model.dataProvider as Array;
+ else return;
+
+ clearGraphics();
+
+ var series:Array = IChart(strand).series;
+
+ var useHeight:Number = UIBase(axisGroup).height;
+ var useWidth:Number = UIBase(axisGroup).width;
+ var xpos:Number = 0;
+ var ypos:Number = useHeight;
+ var minValue:Number = Number.MAX_VALUE;
+ var maxValue:Number = Number.MIN_VALUE;
+
+ // determine minimum and maximum values, if needed
+ if (isNaN(minimum)) {
+ for(var i:int=0; i < items.length; i++) {
+ var value:Number = Number(items[i][valueField]);
+ if (!isNaN(value)) minValue = Math.min(minValue,value);
+ else minValue = Math.min(minValue,0);
+ }
+ } else {
+ minValue = minimum;
+ }
+ if (isNaN(maximum)) {
+ for(i=0; i < items.length; i++) {
+ value = Number(items[i][valueField]);
+ if (!isNaN(value)) maxValue = Math.max(maxValue,value);
+ else maxValue = Math.max(maxValue,0);
+ }
+ } else {
+ maxValue = maximum;
+ }
+
+ var range:Number = maxValue - minValue;
+ var numTicks:Number = 10; // should determine this some other way, I think
+ var tickStep:Number = range/numTicks;
+ var tickSpacing:Number = useHeight/numTicks;
+ var tickValue:Number = minimum;
+
+ // place the labels below the axis enough to account for the tick marks
+ var labelY:Number = UIBase(axisGroup).height + 8;
+
+ for(i=0; i < numTicks+1; i++)
+ {
+ var label:Object = addTickLabel(formatLabel(tickValue), 0, ypos, 0, tickSpacing);
+ label.y = ypos - label.height/2;
+
+ // add a tick mark, too.
+ addTickMark(useWidth-6, ypos, 5, 0);
+
+ ypos -= tickSpacing;
+ tickValue += tickStep;
+ }
+
+ // draw the axis and the tick marks
+ drawAxisPath(useWidth-1, 0, 0, useHeight);
+ drawTickPath(useWidth-6, 0);
+
+ }
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/layouts/BarChartLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/layouts/BarChartLayout.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/layouts/BarChartLayout.as
new file mode 100644
index 0000000..076fb0a
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/layouts/BarChartLayout.as
@@ -0,0 +1,149 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts.beads.layouts
+{
+ import org.apache.flex.charts.core.ICartesianChartLayout;
+ import org.apache.flex.charts.core.IChartItemRenderer;
+ import org.apache.flex.charts.core.IChartSeries;
+ import org.apache.flex.charts.supportClasses.BarSeries;
+ import org.apache.flex.core.IBeadLayout;
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+
+ /**
+ * The BarChartLayout class calculates the size and position of all of the itemRenderers for
+ * all of the series in a BarChart.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class BarChartLayout extends ChartBaseLayout implements IBeadLayout, ICartesianChartLayout
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function BarChartLayout()
+ {
+ super();
+ }
+
+ private var _gap:Number = 20;
+
+ /**
+ * The amount of space to leave between series. If a chart has several series,
+ * the bars for an X value are side by side with a gap between the groups of
+ * bars.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get gap():Number
+ {
+ return _gap;
+ }
+ public function set gap(value:Number):void
+ {
+ _gap = value;
+ }
+
+ /**
+ * @private
+ */
+ override protected function performLayout():void
+ {
+ var selectionModel:ISelectionModel = chart.getBeadByType(ISelectionModel) as ISelectionModel;
+ var dp:Array = selectionModel.dataProvider as Array;
+ if (!dp)
+ return;
+
+ var n:int = dp.length;
+ var useWidth:Number = UIBase(chartDataGroup).width;
+ var useHeight:Number = UIBase(chartDataGroup).height;
+ var itemHeight:Number = (useHeight - gap*(dp.length-1))/dp.length;
+ var seriesHeight:Number = itemHeight/chart.series.length;
+ var ypos:Number = useHeight;
+
+ var maxXValue:Number = 0;
+ var minXValue:Number = 0;
+ var scaleFactor:Number = 1.0;
+ var determineScale:Boolean = true;
+
+ if (horizontalAxisBead != null && !isNaN(horizontalAxisBead.maximum)) {
+ maxXValue = horizontalAxisBead.maximum;
+ determineScale = false;
+ }
+ if (horizontalAxisBead != null && !isNaN(horizontalAxisBead.minimum)) {
+ minXValue = horizontalAxisBead.minimum;
+ }
+
+ for (var s:int = 0; s < chart.series.length; s++)
+ {
+ var bcs:BarSeries = chart.series[s] as BarSeries;
+
+ for (var i:int = 0; i < n; i++)
+ {
+ var data:Object = dp[i];
+ var field:String = bcs.xField;
+
+ var xValue:Number = Number(data[field]);
+ if (determineScale) maxXValue = Math.max(xValue, maxXValue);
+ }
+ }
+
+ var range:Number = maxXValue - minXValue;
+ scaleFactor = useWidth/range;
+
+ for (i = 0; i < n; i++)
+ {
+ data = dp[i];
+
+ for (s=0; s < chart.series.length; s++)
+ {
+ bcs = chart.series[s] as BarSeries;
+
+ var child:IChartItemRenderer = chartDataGroup.getItemRendererForSeriesAtIndex(bcs,i);
+ xValue = Number(data[bcs.xField]) - minXValue;
+ if (xValue > maxXValue) xValue = maxXValue;
+ xValue = xValue * scaleFactor;
+
+ child.x = 0;
+ child.y = ypos - seriesHeight;
+ child.width = xValue;
+ child.height = seriesHeight;
+ ypos -= seriesHeight;
+ }
+
+ ypos -= gap;
+ }
+
+ IEventDispatcher(chart).dispatchEvent(new Event("layoutComplete"));
+ }
+ }
+}
\ No newline at end of file