def bars = new CategoryBars(value: [[1, 2, 3], [1, 3, 5]]) new CategoryPlot() << bars def cplot = new CategoryPlot(initWidth: 400, initHeight: 200) def bars = new CategoryBars(value:[[1, 2, 3], [1, 3, 5]]) cplot << bars def cplot = new CategoryPlot(title: "Hello CategoryPlot!", xLabel: "Categories", yLabel: "Values") cplot << new CategoryBars(value:[[1, 2, 3], [1, 3, 5]]) def cplot = new CategoryPlot(categoryNames: ["Helium", "Neon", "Argon"]) cplot << new CategoryBars(value: [[1, 2, 3], [1, 3, 5]]) new CategoryPlot() << new CategoryBars(value: [[1, 2, 3], [1, 3, 5]], seriesNames: ["Gas", "Liquid"]) def bars = new CategoryBars(value: [[1, 2], [3, 4], [5, 6], [7, 8]], seriesNames: ["Gas", null, "", "Liquid"]) new CategoryPlot() << bars def plot = new CategoryPlot(showLegend: true) // force legend display def bars = new CategoryBars(value: [[1, 2, 3], [1, 3, 5]]) // since no display names were provided, default names "series0" etc will be used. plot << bars def plot = new CategoryPlot(orientation: PlotOrientationType.HORIZONTAL) plot << new CategoryBars(value:[[1, 2, 3], [1, 3, 5]]) def plot = new CategoryPlot(categoryNames: ["Acid", "Neutral", "Base"], categoryNamesLabelAngle: -1/4 * Math.PI) plot << new CategoryBars(value: [[1, 2, 3], [4, 5, 6]]) new CategoryPlot(categoryMargin: 2) << new CategoryBars(value: [[1, 2, 3], [4, 5, 6]]) def bars = new CategoryBars(value: (1..4) + 2) new CategoryPlot() << bars def bars = new CategoryBars(value: [[1, 2], [3, 4], [5, 6]], color: Color.pink) new CategoryPlot() << bars def colors = [Color.red, Color.gray, Color.blue] def bars = new CategoryBars(value: [[1, 2], [3, 4], [5, 6]], color: colors) new CategoryPlot() << bars def colors = [[Color.red, Color.gray], [Color.gray, Color.gray], [Color.blue, Color.pink]] def bars = new CategoryBars(value: [[1, 2], [3, 4], [5, 6]], color: colors) new CategoryPlot() << bars def colors = [Color.pink, [Color.red, Color.gray, Color.blue]] def bars = new CategoryBars(value: [[1, 2, 3], [4, 5, 6]], color: colors) new CategoryPlot() << bars def bars = new CategoryBars(value: [[1, 2, 3], [4, 5, 6]], base: -2) new CategoryPlot() << bars def bars = new CategoryBars(value: [[1, 2, 3], [4, 5, 4]], base: [-1, -3]) new CategoryPlot() << bars def bars = new CategoryBars(value: [[1, 2, 3], [4, 5, 6]], base: [[0, 1, 1], [-4, -5, -6]]) new CategoryPlot() << bars def bars = new CategoryBars(value: [[1, 2, 3], [4, 5, 6]], width: [[0.3, 0.6, 1.7], 1.0]) new CategoryPlot() << bars def bars = new CategoryBars(value: [[1, 2, 3], [4, 5, 6]], fill: [[true, true, false], [true, false, true]], drawOutline: [[true, false, true], [true, true, false]], outlineColor: [Color.black, Color.red]) new CategoryPlot() << bars def bars = new CategoryBars(value: [[1, 2, 3], [4, 5, 8], [10, 9, 10]], base: [0, [1, 2, 3], [4, 5, 8]], centerSeries: true, itemLabel: {value, base-> Math.abs(value-base)}) new CategoryPlot() << bars def ss = [StrokeType.DASH, StrokeType.LONGDASH] def cs = [Color.black, Color.red] new CategoryPlot() << new CategoryStems(value: [[1, 2, 4], [4, 5, 8]], color: cs, style: ss) new CategoryPlot() << new CategoryPoints(value: [[1, 2, 4], [4, 5, 8]]) def ss = [StrokeType.DASH, StrokeType.DOT] new CategoryPlot() << new CategoryLines(value: [[1, 2, 4], [4, 5, 8]], style: ss, seriesNames:["Lanthanide", "Actinide"]) def s1 = [1, 2, 4] def s2 = [4, 5, 8] def lines = new CategoryLines(value: [s1, s2], centerSeries: true) def points = new CategoryPoints(value: [s1, s2], centerSeries: true) def stems = new CategoryStems(value:[s1], base: [s2], style: StrokeType.DOT, color: Color.gray) new CategoryPlot() << lines << points << stems def plot = new CategoryPlot(initWidth: 500, initHeight: 400, title: "Bar Chart Demo", xLabel: "Alkali", yLabel: "Temperature ° Celcius", categoryNames:["Lithium", "Sodium", "Potassium", "Rubidium"]) def s1 = [[10, 15, 13, 7], [22, 18, 28, 17]] def high = [[12.4, 19.5, 15.1, 8.2], [24.3, 23.3, 30.1, 18.2]] def low = [[7.6, 10.5, 10.9, 5.8], [19.7, 12.7, 25.9, 15.8]] def color = [new Color(247, 150, 70), Color.orange, new Color(155, 187, 89)] plot << new CategoryBars(value: s1, color: color, seriesNames: ["Solid", "Liquid"]) plot << new CategoryStems(value: high, base: low, color: color[2]) plot << new CategoryPoints(value: high, outlineColor: color[2], size:12) plot << new CategoryPoints(value: low, outlineColor: color[2], size:12) def p = new CategoryPlot(title: "Multiple Y Axes Demo", yLabel: "Price", categoryNames: ["Q1", "Q2", "Q3", "Q4"]) p << new YAxis(label: "Volume", upperMargin: 1) p << new CategoryBars(value: [[1500, 2200, 2500, 4000]], width: 0.6, color: Color.PINK, yAxis: "Volume", showItemLabel: true, labelPosition: LabelPositionType.VALUE_INSIDE) p << new CategoryLines(value: [[5, 2, 3.5, 4]], color: Color.GRAY, showItemLabel:true) p << new CategoryPoints(value:[[5, 2, 3.5, 4]], color:Color.GRAY) new CategoryPlot() << new CategoryStems(value:[[-3, 2, 4], [4, 5, 8]], width: 10, showItemLabel: true) def bars = new CategoryBars(value: [[-5, 2, 3], [1, 3, 5]], showItemLabel: true) new CategoryPlot() << bars def bars = new CategoryBars(value: [[-5, 2, 3], [1, 3, 5]], labelPosition: LabelPositionType.BASE_OUTSIDE, showItemLabel: true) new CategoryPlot() << bars def plot = new CategoryPlot(title: "Move mouse cursor over bars") def bars = new CategoryBars(value: [[-5, 2, 3], [1, 3, 5]], useToolTip: false) plot << bars def input = [[1,2,3],[1,3,5]].transpose() // == [[1,1], [2,3], [3,5]] def bars = new CategoryBars(value: input) new CategoryPlot() << bars table = [[close:11.59, high:13.15, low:11.92, open:11.92], [close:12.76, high:15.44, low:11.88, open:12.42], [close:18.19, high:20.96, low:17.93, open:18.56]] def v = table.collect { it.values().toList() } def p = new CategoryPlot(categoryNames: table[0].keySet().toList()) p << new CategoryBars(value: v, seriesNames: ["A", "B", "C"]) def cs = [Color.orange] def cp = new CategoryPlot() cp << new CategoryArea(value: [[1, 3, 2]], base: [[0.5, 1, 0]]) cp << new CategoryArea(value: [[2, 1, 0.5]], color: cs)