Content-Type: multipart/alternative; boundary="----_=_NextPart_002_01C76A29.AD8466AB" ------_=_NextPart_002_01C76A29.AD8466AB Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi all, =20 I want to create a histogram that shows the hourly distribution of crimes per day committed by my agents. I have a class CrimeLogger that can return a list with the amount of crime per hour. I would like to use this list to plot the daily distribution of crime in my model. However I do not get it working (see image attachment), I would like the hours to be on the x-axis. I think I'm missing something important here. I use the code below to get the plot shown in the attachment. =20 =20 dailyCrimeHistogram =3D new OpenHistogram("Daily Crime Distribution", 24, 0); dailyCrimeHistogram.setXRange(0, 24); dailyCrimeHistogram.setYRange(0, 100); dailyCrimeHistogram.setAxisTitles("Hour of the day", "Number of crime incidents"); =20 =20 BinDataSource source =3D new BinDataSource() { public double getBinValue(Object o) { return (Double)o; =20 } }; //Below crimeLogger returns a list of 24 doubles dailyCrimeHistogram.createHistogramItem("Crime", crimeLogger.getDailyList(),source);=20 =20 Thanks in advance for the help! =20 Regards, =20 Jeroen ------_=_NextPart_002_01C76A29.AD8466AB Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
Hi all,
I want to create a histogram that shows the =
hourly distribution
of crimes per day committed by my agents. I have a class CrimeLogger =
that can
return a list with the amount of crime per hour. I would like to use =
this list
to plot the daily distribution of crime in my model. However I do not =
get it
working (see image attachment), I would like the hours to be on the =
x-axis. I
think I’m missing something important here. I use the code below =
to get
the plot shown in the attachment.
=
dailyCrimeHistogram =3D new OpenHistogram("Daily Crime Distribution", 24, 0);
=
dailyCrimeHistogram.setXRange(0, 24);
=
dailyCrimeHistogram.setYRange(0, 100);
=
dailyCrimeHistogram.setAxisTitles("Hour of the =
day", "Number of crime incidents"); &nbs=
p; =
=
=
=
BinDataSource
source =3D new =
BinDataSource()
{
=
public =
double getBinValue(Object o) =
{ =
=
&=
nbsp;
return =
(Double)o; &nb=
sp;
=
}
=
=
};
//Below crimeLogger returns a list of 24 =
doubles
&=
nbsp; dailyCrimeHistogram.createHistogramItem("Crime", crimeLogger.getDailyList(),source); =
Thanks =
in
advance for the help!
Regards,
Jeroen