Heatmap colours not presenting correctly

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
cpb
Posts: 10
Joined: Wed Jul 29, 2015 7:12 am
antibot: No, of course not.

Heatmap colours not presenting correctly

Post by cpb » Fri Apr 29, 2016 7:35 am

Hi,

I need to create a chart that uses an XYBlockRenderer, DefaultXYZDataset and XYPlot to present one of 3 possible values for each hour in a given calendar month.

My dataset consists of:
x-axis: milli-seconds
y-axis: 1 (I want a single plot per chart)
z-axis: -1 || 0 || 1 (1 is the default)

This has worked with small sample datasets but fails with larger datasets. I get an empty chart. Only the axes are printed.

I have tried setting the block width to the default (1.0) and the number of hours in the month. Neither makes any difference. Based on previous posts I think the latter is correct.

Because the chart is imported into Jasper Reports I have also exported to an SVG to confirm JR isn't a problem. The SVG also contains an empty chart.

I'd appreciate any suggestions on how to determine why my chart is empty would be much appreciated.

Cheers

John Matthews
Posts: 513
Joined: Wed Sep 12, 2007 3:18 pm

Re: Heatmap colours not presenting correctly

Post by John Matthews » Sat Apr 30, 2016 4:12 am

How large is larger? XYBlockChartDemo1 in the demo renders 100 x 100 blocks nearly instantly, but I'm guessing it doesn't scale well. You may have to render incrementally and merge the pieces; you may have to render at a lower resolution. If you're blocking the event dispatch thread, use a SwingWorker to publish() interim results and add them to your XYZDataset in your implementation of process().

cpb
Posts: 10
Joined: Wed Jul 29, 2015 7:12 am
antibot: No, of course not.

Re: Heatmap colours not presenting correctly

Post by cpb » Tue May 03, 2016 6:51 am

Hi John,

Thanks for the reply. I started out using XYBlockChartDemo2 as my since it was closest to my requirements. Each data point in my charts represents 1 hour so the number of points ranges between 672 and 774 (depending on the month).

Looks like there were a couple of issues with my code; I'll investigate further when time permits. My data source contains datetime strings and my SimpleDateFormat pattern used 'h' instead of 'H'. Also, the getTime method on a Date object returns milliseconds since epoch (I'd assumed it was seconds and ended up with microseconds).

Each dataset now renders correctly. If performance is poor I'll look incremental rendering.

Cheers
Chris

Locked