How to add ticks to surface plot legend

A discussion forum for Orson Charts (a 3D chart library for the Java platform).

How to add ticks to surface plot legend

Postby JohnGarnham » Fri Dec 16, 2016 12:11 am

I am using the LegendBuilder to build a custom legend for the surface plot because we wanted the legend to stretch across the whole pane (which I've done) and we wanted to increase the number of ticks. The latter I am trouble finding how to do - right now it only shows two ticks on the scale, the minimum value and the maximum value. I tried looking through the documentation but could not find anything relevant. Is there a way to set the number of ticks between those?
Posts: 3
Joined: Mon Nov 14, 2016 5:47 pm

Re: How to add ticks to surface plot legend

Postby david.gilbert » Sun Dec 18, 2016 9:41 am

The current legend builder only adds the min and max value to the scale, so there isn’t a possibility to add a scale with intervals marked along the scale.

I think the approach to implement this would be to try to combine an axis alongside the existing ColorScaleElement (by creating a new AxisElement class, to fit in the table layout mechanism, and then having the LegendBuilder return a GridElement combining the two). I was having a look at the code and the tricky part seems to be setting up the List<TickData> that the axis needs for rendering. For axes in the main chart, the list of tick data items is passed to the rendering engine that then updates the anchor points for the labels…then in a later pass, the text labels are rendered at the anchor points. But in a color scale we’d need to maybe use the layout pass to populate the anchor points.

If I get something that works, I’ll send you some (probably incomplete) code. The rest of December is quite busy for me though, so I might not get too much time to look at it.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Ask your company to buy the JFreeChart Developer Guide
:idea: Check out other products sold by my company Object Refinery Limited
JFreeChart Project Leader
Posts: 11575
Joined: Fri Mar 14, 2003 10:29 am

Return to Orson Charts

Who is online

Users browsing this forum: No registered users and 1 guest