Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Dynamically setting the y-axis scale
Dynamically setting the y-axis scale [message #243592] Wed, 20 June 2007 15:14
Nisha is currently offline NishaFriend
Messages: 97
Registered: July 2009
Member
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.
Previous Topic:BIRT XLS data source
Next Topic:Group On / Expression Builder
Goto Forum:
  


Current Time: Wed Jun 26 20:07:10 GMT 2024

Powered by FUDForum. Page generated in 0.02874 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top