MASON-INTEREST-L Archives

July 2009

MASON-INTEREST-L@LISTSERV.GMU.EDU

Options: Use Monospaced Font
Show Text Part by Default
Condense Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Sender:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Date:
Tue, 7 Jul 2009 07:25:41 -0400
Reply-To:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Subject:
From:
Gabriel Catalin Balan <[log in to unmask]>
Content-Type:
TEXT/PLAIN; charset=US-ASCII
In-Reply-To:
MIME-Version:
1.0
Comments:
To: MASON Multiagent Simulation Toolkit <[log in to unmask]>
Parts/Attachments:
TEXT/PLAIN (71 lines)
Hi

Here's how I solved this problem: I taylored the number of bins to the
data.

protected void addSeriesToDataSet(HistogramGenerator.HistogramSeries series)
{
	double[] values = series.getValues();
	if(values.length==0)
	{
		//no data? I'll let HistogramGenerator handle it ;)
		super.addSeriesToDataSet(series);
		return;
	}
	double v = values[0];
	double min = v;
	double max = v;
	for(int i=1;i<values.length;i++)
	{
		v = values[i];
		if(v<min) min = v;
		if(v>max) max = v;
	}
	int bins = (int)(max - min +1);
	dataset.addSeries(series.getName(), values, bins);
}


This is part of a HistogramGenerator class extension with "UnitWideBin"
in the name :)

hope this helps,
Gabriel


On Tue, 7 Jul 2009, MASON-INTEREST-L automatic digest system wrote:

> There is 1 message totalling 22 lines in this issue.
>
> Topics of the day:
>
>   1. Histogram Domain Scaling
>
> ----------------------------------------------------------------------
>
> Date:    Mon, 6 Jul 2009 15:28:02 -0400
> From:    Trent Gordon <[log in to unmask]>
> Subject: Histogram Domain Scaling
>
> I am using the MASON (and therefore JFreeChart) histogram capabilities to
> chart some values on my own, completely removed from my agent simulation.
> (The simulation writes data to a file, which I read at a later time).  I'm
> doing it this way for various un-related reasons.  My problem is I want to
> show one "bar" as 1, the other as 2, then 3, and so on, the height of the
> bar represents the frequency which that number appears in my simulation.
> But The chart that is produced from the HistogramGenerator spreads the bars
> over a range, which is awkward to read.  Is there a way to make each "bar"
> represent one number, or more so, is there a way to give the developer more
> control over the domain scaling and how "wide" the bars are.
>
> I hope I explained my problem clearly.  I'm an experienced developer, but
> completely new to MASON and Multi-Agent simulation.
>
> -T
>
> ------------------------------
>
> End of MASON-INTEREST-L Digest - 5 Jul 2009 to 6 Jul 2009 (#2009-21)
> ********************************************************************
>

ATOM RSS1 RSS2