Print

Print


OK, I definitely have it updating now. Woo!

I've added some methods to the ChartGenerator class to be able to pre-set
the domain and ranges. In case anyone is interested.

public void setRangeAxisRange(double lower, double upper)
        {
        XYPlot xyplot = (XYPlot)(chart.getPlot());
        xyplot.getRangeAxis().setRange(lower, upper);
        }

public void setDomainAxisRange(double lower, double upper)
        {
        XYPlot xyplot = (XYPlot)(chart.getPlot());
        xyplot.getDomainAxis().setRange(lower, upper);
        }

On Mon, Jun 28, 2010 at 4:21 PM, Sean Luke <[log in to unmask]> wrote:

> One of the frustrating parts of JFreeChart is that it's not consistent.
>  The histogram mechanism is totally different from the others.  It drove me
> nuts too.  :-)  However this cover class (HistogramGenerator) is something
> which I wrote in an attempt to make JFreeChart manageable!
>
> Try chart.updateSeries(0, ...)
>
> The updateSeries method basically changes (1) the data -- as an array of
> doubles -- and/or (2) the number of bins in a series.  Your series is
> probably series #0.
>
> Sean
>
>
> On Jun 28, 2010, at 7:05 PM, Paul Smaldino wrote:
>
>  Thanks. I followed/adapted the example in the how-to. I got the histogram
>> to appear with the initial values, but I'm having trouble figuring out how
>> to update the values, since it uses an array of doubles and not an XYSeries.
>>
>> I tried
>> chart.updateSeries(1, as.getAgentConnectivity(), false);
>> where the second term is a double[].  But this doesn't work, possibly due
>> to the indexing? This JFreeChart stuff is pretty confusing.
>>
>> Any tips on how to get the histogram to update?
>>
>> Thanks!
>>
>> -Paul
>>
>> On Mon, Jun 28, 2010 at 3:20 PM, Sean Luke <[log in to unmask]> wrote:
>> You're probably looking for setting up a Chart as a Display -- a permanent
>> fixture in your simulation, appearing under the Displays list, rather than
>> something the user generates on his own.  That way you can customize it
>> however you like.
>>
>> I don't have an example for doing this with a Histogram.  However the
>> process is *very* similar to how it's done with Time Series charts, and
>> there's an example of that in docs/howto.html  ("How to Add a Time-Series
>> Chart Programmatically").
>>
>>
>> At 5:51 PM, Paul Smaldino wrote:
>>
>> Hi,
>>
>> I really like the ability to make a dynamic histogram, as shown in the
>> Heatbugs demo. I'm interested in customizing it so I can pre-set the axis
>> labels, range, number of bins, colors, etc.  However, I'm not sure how to
>> go
>> about doing this. Can anyone help point me in the right direction?
>>
>> Thanks!
>>
>> -Paul
>>
>> --
>> ____________________________
>> Paul Smaldino, M.A.
>> Department of Psychology
>> University of California, Davis
>>
>>
>>
>> --
>> ____________________________
>> Paul Smaldino, M.A.
>> Department of Psychology
>> University of California, Davis
>>
>>


-- 
____________________________
Paul Smaldino, M.A.
Department of Psychology
University of California, Davis