Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement horizontal and stacked bar chart #23

Merged
merged 3 commits into from
Jun 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,18 @@ let package = Package(
name: "BarChartFilledCircleHatchedExample",
dependencies: ["AGGRenderer", "SVGRenderer", "SwiftPlot"],
path: "examples/BarChartFilledCircleHatched"),
.target(
name: "BarChartOrientationHorizontalExample",
dependencies: ["AGGRenderer", "SVGRenderer", "SwiftPlot"],
path: "examples/BarChartOrientationHorizontal"),
.target(
name: "BarChartVerticalStackedExample",
dependencies: ["AGGRenderer", "SVGRenderer", "SwiftPlot"],
path: "examples/BarChartVerticalStacked"),
.target(
name: "BarChartHorizontalStackedExample",
dependencies: ["AGGRenderer", "SVGRenderer", "SwiftPlot"],
path: "examples/BarChartHorizontalStacked"),
//.testTarget(
// name: "swiftplotTests",
// dependencies: ["swiftplot"]),
Expand Down
24 changes: 24 additions & 0 deletions examples/BarChartHorizontalStacked/main.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import SwiftPlot
import AGGRenderer
import SVGRenderer

var filePath = "examples/Reference/"
let fileName = "_18_bar_chart_horizontal_stacked"

let x:[String] = ["2008","2009","2010","2011"]
let y:[Float] = [320,-100,420,500]
let y1:[Float] = [100,100,220,245]

var agg_renderer: AGGRenderer = AGGRenderer()
var svg_renderer: SVGRenderer = SVGRenderer()

var plotTitle: PlotTitle = PlotTitle()

var barGraph: BarGraph = BarGraph()
barGraph.addSeries(x, y, label: "Plot 1", color: .orange, graphOrientation: .horizontal)
barGraph.addStackSeries(y1, label: "Plot 2", color: .blue)
plotTitle.title = "BAR CHART"
barGraph.plotTitle = plotTitle

barGraph.drawGraphAndOutput(fileName: filePath+"agg/"+fileName, renderer: agg_renderer)
barGraph.drawGraphAndOutput(fileName: filePath+"svg/"+fileName, renderer: svg_renderer)
22 changes: 22 additions & 0 deletions examples/BarChartOrientationHorizontal/main.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import SwiftPlot
import AGGRenderer
import SVGRenderer

var filePath = "examples/Reference/"
let fileName = "_08_bar_chart"

let x:[String] = ["2008","2009","2010","2011"]
let y:[Float] = [320,-100,420,500]

var agg_renderer: AGGRenderer = AGGRenderer()
var svg_renderer: SVGRenderer = SVGRenderer()

var plotTitle: PlotTitle = PlotTitle()

var barGraph: BarGraph = BarGraph()
barGraph.addSeries(x, y, label: "Plot 1", color: .orange, graphOrientation: .horizontal)
plotTitle.title = "BAR CHART"
barGraph.plotTitle = plotTitle

barGraph.drawGraphAndOutput(fileName: filePath+"agg/"+fileName, renderer: agg_renderer)
barGraph.drawGraphAndOutput(fileName: filePath+"svg/"+fileName, renderer: svg_renderer)
24 changes: 24 additions & 0 deletions examples/BarChartVerticalStacked/main.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import SwiftPlot
import AGGRenderer
import SVGRenderer

var filePath = "examples/Reference/"
let fileName = "_17_bar_chart_vertical_stacked"

let x:[String] = ["2008","2009","2010","2011"]
let y:[Float] = [320,-100,420,500]
let y1:[Float] = [100,100,220,245]

var agg_renderer: AGGRenderer = AGGRenderer()
var svg_renderer: SVGRenderer = SVGRenderer()

var plotTitle: PlotTitle = PlotTitle()

var barGraph: BarGraph = BarGraph()
barGraph.addSeries(x, y, label: "Plot 1", color: .orange)
barGraph.addStackSeries(y1, label: "Plot 2", color: .blue)
plotTitle.title = "BAR CHART"
barGraph.plotTitle = plotTitle

barGraph.drawGraphAndOutput(fileName: filePath+"agg/"+fileName, renderer: agg_renderer)
barGraph.drawGraphAndOutput(fileName: filePath+"svg/"+fileName, renderer: svg_renderer)
Binary file modified examples/Reference/agg/_08_bar_chart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/Reference/agg/_09_bar_chart_forward_slash_hatched.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/Reference/agg/_10_bar_chart_backward_slash_hatched.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/Reference/agg/_11_bar_chart_vertical_hatched.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/Reference/agg/_12_bar_chart_horizontal_hatched.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/Reference/agg/_13_bar_chart_grid_hatched.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/Reference/agg/_14_bar_chart_cross_hatched.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/Reference/agg/_15_bar_chart_hollow_circle_hatched.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/Reference/agg/_16_bar_chart_filled_circle_hatched.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions examples/Reference/svg/_08_bar_chart.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions examples/Reference/svg/_11_bar_chart_vertical_hatched.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions examples/Reference/svg/_12_bar_chart_horizontal_hatched.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions examples/Reference/svg/_13_bar_chart_grid_hatched.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions examples/Reference/svg/_14_bar_chart_cross_hatched.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 48 additions & 0 deletions examples/Reference/svg/_17_bar_chart_vertical_stacked.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading