jfreechart different series color - dataset

I have XYAreaChart and a dataset = new XYSeriesCollection();
This dataset is populated with several XYSeries and i want each one of these series to have a different color. The series can overlapse each other.
Does anyone have any idea how to do this?
I tried a number of things and it keeps painting everything with the same color.

Related

Same data looks different in time-series line chart and bar chart

Im showing identical data in two different charts:
But for some reason all bar charts show different time series for the graph. It should start from Mar.25 and end Apr.9
You might try looking at the style tab for the charts and selecting the correct range setting on the x axis.

Can you set multiple paints on the same XYPlot?

So I have a working XYPlot but I want to add different colors to the background, not a single one. I know this appears to be doable for quadrants, but I want it basically row by row, or ranges of rows I should say.
Basically something like this :
but with ideally 3-4 colors instead of just 2. Can you set the background paint for a specified Axis range for example? I haven't found any info or way to do it yet.
IntervalMarker "Represents an interval to be highlighted in some way." In the example below, two markers span the plot's range.
XYPlot plot = new XYPlot(…);
plot.addRangeMarker(new IntervalMarker(.3, 1, new Color(0x60CCFFE5, true)));
plot.addRangeMarker(new IntervalMarker(0, .3, new Color(0x60FFCCE5, true)));

How to set telerik chart TrackBall position programatically

I have created a custom control which has Telerik RadCartesianChart. This custom control creates any number of charts based on user dropdown selection. The number of charts on screen can vary but all have same x axis. I added a chart track ball line on custom control which is working fine on one chart on mouse movement. I want to add the same track ball line on all of the other chart on window so that movement on one track ball would reflect the same position on the other charts.
How could I implement this behavior programmatically?
I don't know if you can do what you are attempting without adding a ChartTrackBallController to every chart.
What I'd suggest is adding multiple series to the one chart, share the X axis but have multiple Y axes as required. This way the ChartTrackBallController will pick a point on all series in the chart.
// Trackball
ChartTrackballController ctbcMain = new ChartTrackballController();
ctbcMain.TextNeeded += ctbcMain_TextNeeded;
ctbcMain.InnerPointSize = new SizeF(0, 0);
ctbcMain.OuterPointsSize = new SizeF(0, 0);
rcvUPM.Controllers.Add(ctbcMain);
rcvUPM.ShowTrackBall = true;
In the above code snippit, rcvUPM is a radchartview containing all the data series you want to show, and ctbcMain_TextNeeded is used to customise the content of what the hover for the trackball shows.
It seems that by default the hover content will contain multiple points from each series, even after the InnerPointSize and OuterPointsSize was set to zero on advice by Telerik support a LINQ FirstOrDefault was needed on the collection of DataPointInfo objects to limit it to one point per series.

How to change shape of elements in the legend - jFreeChart?

How I can change the shape of elements of legend for jFreeChart without changing the graphs of diagrams ?
I have ready time series diagram. I need to update the existed data markers in legend to the simple line with defined colors.
Start by not adding a LegendTitle to your chart. This is usually a controlled by a parameter to your ChartFactory or your JFreeChart constructor. Both CategoryPlot and XYPlot have a setFixedLegendItems() method, mentioned here, that you can use to add a collection of arbitrary legend items.

How to synchronize TimeSeries colour with Marker colour in JFreeChart?

I am displaying several time series lines along with Markers on a JFreeChart plot. Different markers are related to different time series and I would like them to appear in the same colour. So how do I find out for a given TimeSeries what is colour is?
You should be able to use lookupSeriesPaint() for a given series. See also this example that overrides getItemPaint(), which calls lookupSeriesPaint().

Resources