How to show gaps in line Jfreechart? - jfreechart

I am using jfreechart to draw a line chart for some monthly data. It is working fine but I do not want to connect those data points which there are some gaps between them. for example I don't want to connect the point for 1/31/2015 to the point for 3/30/2015 because there is no data for 2/28/2015. Is there any configuration for jfreechart to handle this issue?

All you need to do is put a data point for 2/28/2015 with a value of Double.NaN - JFreeChart will then automatically display a gap...

Related

Google Data Studio Hide Data on Line Chart

Can I hide data number on line chart to make it only show the trend instead of the actual data?
To remove the Axis, switching from a Time Series Chart to a Sparkline Chart does the trick (or manually remove the required labels and Axis from the Style Tab of the Time Series Chart).
To prevent interactions with the Chart, one approach is to add a transparent Shape over the Chart.
Google Data Studio Report and a GIF to elaborate:

How to hide axis bars in area chart and line chart in Google Data Studio

I currently have this issue where I am trying to hide the Y-axis of this line chart. Currently there is only the option to hide both axes in GDS.
Issue being is that the floating number at the y axis looks awkward.
Could anyone think of a work around? maybe hiding both axes and then creating a blank chart with the date values and using that as the x axis ticks.
One workaround is to draw a Shape or line over the axis and set it to a colour that blends in with the background, (although in the case above, it would cut into the first data point and data label) using Shift + movement keys for precision placement.
Google Data Studio Report as well as a GIF to elaborate:

Create forest plot using JFreeChart

Does anyone have an example of how to render a forest plot using JFreeChart (or another Java-based open source charting library, but JFreeChart is preferred due to the integration with Jasper Reports)?
See https://en.wikipedia.org/wiki/Forest_plot for description of the forest plot.
I was thinking about hacking somethign together using a horizontal bar chart where left side of the axis is the categorical value, and right side is the range, but the problem is the data for a forest plot comes in a set of data like: category, min, max. Such as an odd ratio with a confidence interval that spans between -.1 to 1.2. The forrest plot would basically be a line drawn between -.1 and 1.2 with a diamond marker directly in the middle (around .55).
If anyone has experience on building this visualization in JFreeChart, it would be much appreciated!
While this is not supported directly in the current release, a reasonable facsimile should be possible. Instead of a bar chart, consider using a MinMaxCategoryRenderer having PlotOrientation.HORIZONTAL and custom icons, as shown here. Add a CategoryMarker or CategoryLineAnnotation with a dashed Stroke to the CategoryPlot for the centerline; add a CategoryItemLabelGenerator to handle the labels.

Initialize JFreeChart range axis values

I am trying to load dataset during initialization of the JFreeChart. But every time I tried to create a dataset with higher "number of item per series", the more data (all data) displayed visible in the chart (the bigger the dataset, the smaller the graph). But actually what I wanted is to have the fixed range of dataset values displayed on the chart while the rest is still hidden. Just the same way the data would normally be displayed in the actual trading platform, let's say Metatrader (MT4). First time when I open the chart I can see the screen filled with the only visible dataset of the chart and if I left-scroll the chart I will be able to see the old/history dataset as well. Does anyone have idea how to achieve this using JFreechart?
Really appreciate for any help or any thing/articles I can refer. Thanks so much!
You can use setRange() on either the domain or range axis, as shown in this fragment. If you've already tried this, it may help to edit your question to include an sscce and/or image that exhibits any problems you encountered.

Reporting with Jfreechart?

I have created a chart using jfreechart library. I have the data set that use to create the graph. Is there any way I can get a report of the data in a tabular form directly from the jfreechart chart object.. Or any other ways where i can create report using jfreechart
Thank you
Assuming an XYDataset for example, one approach is to extend AbstractXYDataset and implement TableModel. Then you can construct a JTable, which is easy to render or print.

Resources