How do you simply just change the colour of the bars or lines on graphs? Theres no Tag for it.
I have recently chosen to use Cewolf for some overview graphs on a website design. Due to the nature of these graphs, they need to have no X or Y labling what so ever.
Ulf Dittmer wrote:
That's the realm of chart postprocessors (which let you alter the appearance of a chart in ways for which there is no dedicated cewolf tag). Cewolf comes with a number postprocessors, among them de.laures.cewolf.cpp.SeriesPaintProcessor which can change the colors in various types of plots. The "Cewolf Set" demo of the example web app shows it in action in the StackedHorizontalBar and LineChart charts (the source for this is part of the cewolfset.jsp page).
Ulf Dittmer wrote:
That, too, is a job of postprocessors, but there's no pre-made one that does this; shouldn't be hard, though. The general flow in the processChart method would be: 1) get the plot, 2) cast it to XYPlot, 3) get domain and range axes 4) cast those to NumberAxis, 5) call the setNumberFormatOverride(java.text.NumberFormat) method with a NumberFormat that always returns the empty string.
If you do end up writing a postprocessor, you might consider donating the code to the cewolf project; I can guarantee that it would find its way into the distribution :-)
Ulf Dittmer wrote:Actually, I've thought about this some more, and decided that it would make sense to add parameters to the chart tag that allow you to set this. So I've just uploaded a new version of the library that implements it; the Testpage of the example web app shows those attributes in action.
Ulf Dittmer wrote:You can get closer to that through JFreeChart.setPadding(new RectangleInsets(...)) and Plot.setInsets(new RectangleInsets(....)) with zero-valued parameters, but probably not quite down to adjacent charts.
Have you considered a single chart that has all the values, and then adding a custom domain axis that displays a single string for each day?
Ulf Dittmer wrote:You can get closer to that through JFreeChart.setPadding(new RectangleInsets(...)) and Plot.setInsets(new RectangleInsets(....)) with zero-valued parameters, but probably not quite down to adjacent charts.
Have you considered a single chart that has all the values, and then adding a custom domain axis that displays a single string for each day?
Ulf Dittmer wrote:That was just sample usage - you need to replace "JFreeChart" by a reference to a JFreeChart object - which the post-processor will give you.
Consider Paul's rocket mass heater. |