Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Area chart with dynamic X-axis markers
jbeltran
I have two DataSets <br />
<br />
<ul class='bbc'><li>application performance measures over time (pairs float/datetime) (SQLDataSource)</li><li>software version changes (pairs string/datetime) (ScriptedDataSource)</li></ul>
I want to generate a grapth with both data mixed which can easily show performance changes over software changes.<br />
<br />
We are trying to create an area graph and set vertical markers by Javascript, but any attempt has failed.<br />
<br />
How would you do that?<br />
<br />
My code is:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
function beforeGeneration( chart, icsc )
{
importPackage(Packages.org.eclipse.birt.chart.model.component.impl);
importPackage(Packages.org.eclipse.birt.chart.model.data.impl);
importPackage(Packages.org.eclipse.birt.chart.model.attribute);
importPackage(Packages.org.eclipse.birt.chart.model.attribute.impl);
var rpCtx = icsc.getExternalContext().getScriptable();
var vect = rpCtx.getPersistentGlobalVariable("releasesVector");
var size = vect.size();
var xAxis = chart.getPrimaryBaseAxes()[0];
importPackage(Packages.java.util);
importPackage(Packages.java.text);
var sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm", Locale("es_ES"));
for(var i=0;i<size; i++){
var version = vect.get(i);
var d = sdf.parse(version[1]);
var cal = Calendar.getInstance();
cal.setTime(d);
var marker = MarkerLineImpl.create(xAxis, DateTimeDataElementImpl.create(cal.getTimeInMillis()));
marker.getLabel().getCaption().setValue(version[0]);
marker.getLineAttributes().getColor().set(255,0,0);
}
return;
}
</pre>
<br />
And the generation does not complain about anything and the graph has no markers.<br />
<br />
Any ideas?
Find more posts tagged with
Comments
mwilliams
Hi,
Have you seen this example that talks about creating dynamic marker lines?
http://www.birt-exchange.org/org/devshare/designing-birt-reports/276-birt-chart-scripting:-dynamic-markers-and-datapoint-colors/