I have a situation where i'd like my chart to resize itself according to the amount of data. Basically i want to have a constant n pixels between each tick, and base the size on that. (The chart would be displayed inside a scroll bar).
Problem is, all the tick information is calculated in the draw thread. You don't know how many ticks there are until after the chart's been drawn once. So you have to draw, then resize, then draw again, which is unsightly and doesn't perform well.
I understand why it's designed this way - you want to use the same chart object in a variety of graphics contexts. That's cool.
But is there a way i can get the result i want without a great deal of branching and hacking on the original classes? If there's a simple solution or swing trick i haven't thought of, i'd love to hear about it. If not, i'd be willing to work with the authors on building a solution, but obviously don't want to do so in a vacuum.
calculating ticks outside of draw()
Re: calculating ticks outside of draw()
Hi Jon,
It won't be easy to do. The existing code is aimed at laying out a chart that looks good, given a predetermined amount of space, rather than letting the chart decide how much space to use.
Regards,
DG.
It won't be easy to do. The existing code is aimed at laying out a chart that looks good, given a predetermined amount of space, rather than letting the chart decide how much space to use.
Regards,
DG.