Skip to content

Commit

Permalink
Add more stacking samples for column and bar charts
Browse files Browse the repository at this point in the history
  • Loading branch information
AAChartModel committed Jan 22, 2024
1 parent efb30cb commit f330bbb
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 86 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,22 @@ class CustomStyleForBarChartComposer {
static func randomColorfulBarChart() -> AAChartModel {
CustomStyleForColumnChartComposer.randomColorfulColumnChart().chartType(.bar)
}

static func stackingPolarBarChart() -> AAChartModel {
CustomStyleForColumnChartComposer.stackingPolarColumnChart().chartType(.bar)



static func noneStackingPolarBarChart() -> AAChartModel {
CustomStyleForColumnChartComposer.noneStackingPolarColumnChart().chartType(.bar)
}


static func normalStackingPolarBarChart() -> AAChartModel {
CustomStyleForColumnChartComposer.normalStackingPolarColumnChart().chartType(.bar)

}

static func percentStackingPolarBarChart() -> AAChartModel {
CustomStyleForColumnChartComposer.percentStackingPolarColumnChart().chartType(.bar)
}




Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,64 +14,17 @@ class CustomStyleForBarChartVC: AABaseChartVC {
// Do any additional setup after loading the view.
}

// private func colorfulBarChart() -> AAChartModel {
// CustomStyleForColumnChartComposer.colorfulColumnChart()
// }
//
// private func colorfulGradientColorBarChart() -> AAChartModel {
// CustomStyleForColumnChartComposer.colorfulGradientColorColumnChart()
// }
//
// private func discontinuousDataBarChart() -> AAChartModel {
// CustomStyleForColumnChartComposer.discontinuousDataColumnChart()
// }
//
// private func randomColorfulBarChart() -> AAChartModel {
// CustomStyleForColumnChartComposer.randomColorfulColumnChart()
// }
//
// private func stackingPolarBarChart() -> AAChartModel {
// CustomStyleForColumnChartComposer.stackingPolarColumnChart()
// }


// private func specialStyleForTheSingleDataElementOfColumnChart() -> AAChartModel {
// CustomStyleForColumnChartComposer.specialStyleForTheSingleDataElementOfColumnChart()
// }
//
// private func noMoreGroupingAndOverlapEachOtherBarChart() -> AAChartModel {
// CustomStyleForColumnChartComposer.noMoreGroupingAndOverlapEachOtherColumnChart()
// }
//
// private func noMoreGroupingAndNestedBarChart() -> AAChartModel {
// CustomStyleForColumnChartComposer.noMoreGroupingAndNestedColumnChart()
// }
//
// private func topRoundedCornersStackingBarChart() -> AAChartModel {
// CustomStyleForColumnChartComposer.topRoundedCornersStackingColumnChart()
// }
//
// private func freeStyleRoundedCornersStackingBarChart() -> AAChartModel {
// CustomStyleForColumnChartComposer.freeStyleRoundedCornersStackingColumnChart()
// }
//
//
//
//
// private func customBorderStyleAndStatesHoverColorBarChart() -> AAChartModel {
// CustomStyleForColumnChartComposer.customBorderStyleAndStatesHoverColorColumnChart()
// }
//
// private func negativeDataMixedPositiveDataBarChart() -> AAChartModel {
// CustomStyleForColumnChartComposer.negativeDataMixedPositiveDataColumnChart()
// }
override func chartConfigurationWithSelectedChartTypeString(_ selectedChartTypeStr: String) -> Any? {
switch selectedChartTypeStr {
case "colorfulBarChart":return CustomStyleForBarChartComposer.colorfulBarChart()
case "colorfulGradientColorBarChart":return CustomStyleForBarChartComposer.colorfulGradientColorBarChart()
case "discontinuousDataBarChart":return CustomStyleForBarChartComposer.discontinuousDataBarChart()
case "randomColorfulBarChart":return CustomStyleForBarChartComposer.randomColorfulBarChart()
case "stackingPolarBarChart":return CustomStyleForBarChartComposer.stackingPolarBarChart()

case "noneStackingPolarBarChart":return CustomStyleForBarChartComposer.noneStackingPolarBarChart()
case "normalStackingPolarBarChart":return CustomStyleForBarChartComposer.normalStackingPolarBarChart()
case "percentStackingPolarBarChart":return CustomStyleForBarChartComposer.percentStackingPolarBarChart()

case "specialStyleForTheSingleDataElementOfBarChart":return CustomStyleForBarChartComposer.specialStyleForTheSingleDataElementOfBarChart()
case "noMoreGroupingAndOverlapEachOtherBarChart":return CustomStyleForBarChartComposer.noMoreGroupingAndOverlapEachOtherBarChart()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,33 +169,43 @@ class CustomStyleForColumnChartComposer {
.colorByPoint(true)//When using automatic point colors pulled from the options.colors collection, this option determines whether the chart should receive one color per series or one color per point. Default Value:false.
])
}
static func stackingPolarColumnChart() -> AAChartModel {

static func noneStackingPolarColumnChart() -> AAChartModel {
AAChartModel()
.chartType(.column)
.xAxisLabelsStyle(AAStyle(color: AAColor.white))
.dataLabelsEnabled(false)
.backgroundColor("#22324c")//To make the chart background color transparent, set backgroundColor to "rgba (0,0,0,0)" or "# 00000000". Also make sure `aaChartView!.IsClearBackgroundColor = true`
.polar(true)
.stacking(.percent)
.series([
AASeriesElement()
.name("Tokyo")
.data([7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6])
,
AASeriesElement()
.name("New York")
.data([0.2, 0.8, 5.7, 11.3, 17.0, 22.0, 24.8, 24.1, 20.1, 14.1, 8.6, 2.5])
,
AASeriesElement()
.name("Berlin")
.data([0.9, 0.6, 3.5, 8.4, 13.5, 17.0, 18.6, 17.9, 14.3, 9.0, 3.9, 1.0])
,
AASeriesElement()
.name("London")
.data([3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8])
,
])
.chartType(.column)
.xAxisLabelsStyle(AAStyle(color: AAColor.white))
.dataLabelsEnabled(false)
.backgroundColor("#22324c")//To make the chart background color transparent, set backgroundColor to "rgba (0,0,0,0)" or "# 00000000". Also make sure `aaChartView!.IsClearBackgroundColor = true`
.polar(true)
.stacking(.none)
.series([
AASeriesElement()
.name("Tokyo")
.data([7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6])
,
AASeriesElement()
.name("New York")
.data([0.2, 0.8, 5.7, 11.3, 17.0, 22.0, 24.8, 24.1, 20.1, 14.1, 8.6, 2.5])
,
AASeriesElement()
.name("Berlin")
.data([0.9, 0.6, 3.5, 8.4, 13.5, 17.0, 18.6, 17.9, 14.3, 9.0, 3.9, 1.0])
,
AASeriesElement()
.name("London")
.data([3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8])
,
])
}

static func normalStackingPolarColumnChart() -> AAChartModel {
noneStackingPolarColumnChart()
.stacking(.normal)
}

static func percentStackingPolarColumnChart() -> AAChartModel {
noneStackingPolarColumnChart()
.stacking(.percent)
}

static func specialStyleForTheSingleDataElementOfColumnChart() -> AAChartModel {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ class CustomStyleForColumnChartVC: AABaseChartVC {
case "colorfulGradientColorColumnChart":return CustomStyleForColumnChartComposer.colorfulGradientColorColumnChart()
case "discontinuousDataColumnChart":return CustomStyleForColumnChartComposer.discontinuousDataColumnChart()
case "randomColorfulColumnChart":return CustomStyleForColumnChartComposer.randomColorfulColumnChart()
case "stackingPolarColumnChart":return CustomStyleForColumnChartComposer.stackingPolarColumnChart()

case "noneStackingPolarColumnChart":return CustomStyleForColumnChartComposer.noneStackingPolarColumnChart()
case "normalStackingPolarColumnChart":return CustomStyleForColumnChartComposer.normalStackingPolarColumnChart()
case "percentStackingPolarColumnChart":return CustomStyleForColumnChartComposer.percentStackingPolarColumnChart()

case "specialStyleForTheSingleDataElementOfColumnChart":return CustomStyleForColumnChartComposer.specialStyleForTheSingleDataElementOfColumnChart()
case "noMoreGroupingAndOverlapEachOtherColumnChart":return CustomStyleForColumnChartComposer.noMoreGroupingAndOverlapEachOtherColumnChart()
Expand Down
20 changes: 16 additions & 4 deletions AAInfographicsDemo/Demo/MainVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,10 @@ class MainVC: UIViewController {
"colorfulGradientColorColumnChart---多彩颜色渐变柱状图",
"discontinuousDataColumnChart---数值不连续の柱状图",
"randomColorfulColumnChart---随机颜色の多彩柱状图",
"stackingPolarColumnChart---堆积效果の极化柱状图",

"noneStackingPolarColumnChart---无堆积效果の极化柱状图",
"normalStackingPolarColumnChart---常规堆积效果の极化柱状图",
"percentStackingPolarColumnChart---百分比堆积效果の极化柱状图",

"specialStyleForTheSingleDataElementOfColumnChart---单个数据元素特别风格柱状图",
"noMoreGroupingAndOverlapEachOtherColumnChart---不分组的相互重叠柱状图",
Expand All @@ -225,7 +228,10 @@ class MainVC: UIViewController {
"colorfulGradientColorBarChart---多彩颜色渐变条形图",
"discontinuousDataBarChart---数值不连续の条形图",
"randomColorfulBarChart---随机颜色の多彩条形图",
"stackingPolarBarChart---堆积效果の极化条形图",

"noneStackingPolarBarChart---无堆积效果の极化条形图",
"normalStackingPolarBarChart---常规堆积效果の极化条形图",
"percentStackingPolarBarChart---百分比堆积效果の极化条形图",

"specialStyleForTheSingleDataElementOfColumnChart---单个数据元素特别风格条形图",
"noMoreGroupingAndOverlapEachOtherBarChart---不分组的相互重叠条形图",
Expand Down Expand Up @@ -316,7 +322,10 @@ class MainVC: UIViewController {
"colorfulGradientColorColumnChart",
"discontinuousDataColumnChart",
"randomColorfulColumnChart",
"stackingPolarColumnChart",

"noneStackingPolarColumnChart",
"normalStackingPolarColumnChart",
"percentStackingPolarColumnChart",

"specialStyleForTheSingleDataElementOfColumnChart",
"noMoreGroupingAndOverlapEachOtherColumnChart",
Expand All @@ -333,7 +342,10 @@ class MainVC: UIViewController {
"colorfulGradientColorBarChart",
"discontinuousDataBarChart",
"randomColorfulBarChart",
"stackingPolarBarChart",

"noneStackingPolarBarChart",
"normalStackingPolarBarChart",
"percentStackingPolarBarChart",

"specialStyleForTheSingleDataElementOfBarChart",
"noMoreGroupingAndOverlapEachOtherBarChart",
Expand Down

0 comments on commit f330bbb

Please sign in to comment.