MASON-INTEREST-L Archives

July 2010

MASON-INTEREST-L@LISTSERV.GMU.EDU

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

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

Print Reply
Subject:
From:
"Maciej M. Latek" <[log in to unmask]>
Reply To:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Date:
Fri, 9 Jul 2010 11:16:18 -0400
Content-Type:
multipart/mixed
Parts/Attachments:
Dear Vlasios,

Attached are my attempts on creating multi-Y axes graphs (and stacked
time series) for Mason.

Those classes perform the same function as standard
TimeSeriesChartGenerator. For example, to use
MultiTimesSeriesChartGenerator I put in my *WithGUI the following
code:

opiumTradingChart = new MultiTimeSeriesChartGenerator();
opiumTradingChart.setTitle("Opium trading");
opiumTradingChart.setDomainAxisLabel("Time");
opiumTradingChart.setRangeAxisLabel("Volume");
opiumTradingChart.addSeries(myReporter.opiumTradeVolume, null, 0);
opiumTradingChart.addSeries(myReporter.opiumSellOrders, null, 1);
opiumTradingChart.addSeries(myReporter.opiumBuyOrders, null, 2);
opiumTradingFrame = opiumTradingChart.createFrame(this);
controller.registerFrame(opiumTradingFrame);

Last argument for addSeries is index of axis on which time series is
to be placed. The effect is shown in attached pdfs (saved using save
to pdf button).

Caveats: in ChartGenerator (in sim.util.media) I had to change:

/** The chart */
       protected JFreeChart chart;

to:

/** The chart */
       public JFreeChart chart;

and added method:

public void addLegend() {

if (chart.getLegend() == null) {

LegendTitle title = new LegendTitle(chart.getXYPlot());
title.setLegendItemGraphicPadding(new org.jfree.ui.RectangleInsets(0,
8, 0, 4));chart.addLegend(title);
}
}

to be able to access through code properties of JFreeChart objects for
which there was no setter and getter provided and do stuff like change
fonts and save graphs to pdf automatically at the end of run. It
should not be required to get those two classes to work in principle
though.

The code is not 100% complete, sometimes left hand axis loses color
and I have not tied in all controls.

Hope it helps,

Maciej


ATOM RSS1 RSS2