How to change shape of elements in the legend - jFreeChart? - 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.

Related

How to overlay/merge two types of charts in recharts?

I am looking to merge bar chart and line chart in the same responsive container in recharts, in a way that they overlay each other. It is possible?
You need Composed Chart from their API and you can decide what chart can overlay another by placing it higher or lower in your code.

How can i disable some of the legend at livechart?

I am using live-chart to plot some series. I also want to add a border to chart area so I added it as a new series. but when I want to show the legend of the main series the legend of border will be appear at chart. Is there any solution to disable this specific legend?
You can change the visibility of a series by changing the Visibility Attribute
e.g:
series.Visibility = Visibility.Hidden;
Not sure If that already solves your problem, since I'm not sure if I understood you correctly. You can also change the z index of a series by using the SetZIndex Method
e.g:
System.Windows.Controls.Panel.SetZIndex(series, 0);

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.

jqplot pie chart with empty dataset

I want to have an empty pie chart in case when no data has been given to draw a pie chart.
If I am passing an empty array for dataset then it is not rendering anything in canvas.
Can anybody update me how I can manage this, when there is not any data it should draw a blank circle so that user can feel like chart is there but not having any data to be displayed.
I faced same issue. I used 2 functions to differently draw for no data & data present. In no-data, I used 1 as input to show full circle but with colors and tags that convey no data present.

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