Dynamically setting the y-axis scale [message #243592] |
Wed, 20 June 2007 11:14 |
Eclipse User |
|
|
|
Hi,
I need to set the Y-Axis scale dynamically. My dataset is providing the
min/max for the axis. I have the following code for the "fetch" method of
the datasetL
if (!trendNameIterator.hasNext())
{
return false;
}
else
{
trendNameNode = trendNameIterator.next();
row["TrendName"] = trendNameNode.getTrendName();
row["ResponseNode"] = trendNameNode;
row["ResponseCnt"] = trendNameNode.getResponseCnt();
row["MC"] = trendNameNode.getMultipleChoice();
row["MaxVal"] = trendNameNode.getMaxResponseValue();
row["MinVal"] = trendNameNode.getMinResponseValue();
reportContext.setPersistentGlobalVariable("maxValue", new
Float(trendNameNode.getMaxResponseValue()));
reportContext.setPersistentGlobalVariable("minValue", new
Float(trendNameNode.getMinResponseValue()));
return true;
}
I have defined the beforeGeneration function as:
function beforeGeneration( chart, context ){
// Axis information
xAchse = chart.getBaseAxes();
yAchse = chart.getOrthogonalAxes(xAchse[0], true);
// getScale yields all information about the scale (min, max, step ...)
s = yAchse[0].getScale();
scriptable = context.getExternalContext().getScriptable();
maxValue = scriptable.getPersistentGlobalVariable("maxValue");
minValue = scriptable.getPersistentGlobalVariable("minValue");
// create new data element
max =
Packages.org.eclipse.birt.chart.model.data.impl.NumberDataEl ementImpl.create(maxValue);
min =
Packages.org.eclipse.birt.chart.model.data.impl.NumberDataEl ementImpl.create(minValue);
// set new max and step width
s.setMax (max);
s.setMin (min);
//s.setStep (2.0);
// ... finally set the scale of the axis
//yAchse[0].setScale(s);
}
My Y-axis scale has changed. However, the min and max are always 1.0 and
3.0. They are not what I have specified. Am I missing something here?
Any help is greatly appreciated.
|
|
|
Powered by
FUDForum. Page generated in 0.42678 seconds