In the GroupBarChart class of the example code, you provide an example of a StackedBarPlot. What must be changed in the example to get the stacked bars to be drawn horizontally (the x and y axis are inverted)?
I tried adding 1 line to the example code:
thePlot2.setBarOrient(HORIZ_DIR); (see code below)
but that (alone) breaks the example.
StackedBarPlot thePlot2 = new StackedBarPlot(pTransform2, Dataset1, ChartCalendar.getCalendarWidthValue(Calendar.YEAR,0.75), 0.0, attribArray, ChartConstants.JUSTIFY_CENTER); NumericLabel bardatavalue = thePlot2.getPlotLabelTemplate(); bardatavalue.setTextFont(theFont); bardatavalue.setNumericFormat(ChartConstants.CURRENCYFORMAT); bardatavalue.setDecimalPos(1); bardatavalue.setColor(Color.black); thePlot2.setPlotLabelTemplate(bardatavalue); thePlot2.setBarDatapointLabelPosition(ChartConstants.CENTERED_BAR); thePlot2.setShowDatapointValue(true); thePlot2.setBarOrient(HORIZ_DIR); //this line breaks example gWG.addChartObject(thePlot2);
There is a horizontal stacked bar example: bargraphs.LandOfTheFry. It uses a CartesianCoordinates coordinate system (numeric scale for x and y).
You seem to be using a time coordinate system. Is that the case? Do you want a time-based x-axis or y-axis? What exactly does your data look like? Do you have time-based x-values in your TimeGroupDataset and numeric values as the y-group values.