Discussions
Categories
Choose a Product
THRUST SERVICES
CORE APPS
CE PRODUCTS
...
Quick Links
POPULAR
HELPFUL TIPS
Groups
My Links
FOR SIGNED IN MEMBERS:
Back to website
Home
Designing Analytics Reports
Bar Chart - X Axys label with Y Serie 2 value
Migrateduser
<p>Hi everyone,</p>
<p> </p>
<p>I´m using open source Birt 4.2.0 and trying to design a Bar Chart with 2 "Y series". One with a value and other with the accumulated. In the X serie i put the year and all is grouping by the year.</p>
<p> </p>
<p>In the X label i want to put the value corresponding with the Second serie of the Y Axis (the value of the year).</p>
<p> </p>
<p>I´ve tryed to do it like this:</p>
<pre class="_prettyXprint _lang-js">
var index = null;
var maxSerie = null;
var counter = 0;
var listVentas;
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);
sd = chart.getAxes().get(0).getAssociatedAxes().get(0).getSeriesDefinitions().get(1);
rs = sd.getRunTimeSeries();
//Inicio contador del total de los valores para la linea de la derecha
var contTotal = 0 ;
var max = 0;
listVentas = rs.get(0).getDataSet().getValues();
for (var i = 0; i < listVentas.length; i++){
contTotal = contTotal + listVentas[i];
if (listVentas[i] > max){
max = listVentas[i];
maxSerie = max;
index = i;
}
}
}
function beforeDrawDataPoint(dph, fill, icsc)
{
temp = dph.getOrthogonalValue();
tempF = maxSerie;
if(dph.getIndex() == index && temp == tempF && counter == 0) {
fill.set(185, 206, 149);
counter += 1;
}
}
function beforeDrawDataPointLabel( dph, label, icsc )
{
var mylab = listVentas[dph.getIndex()];
label.getCaption().setValue(mylab);
}
</pre>
<p>Doesn´t work...</p>
<p>Then I tryed to change it with a text but nothing change... the label appears empty</p>
<pre class="_prettyXprint _lang-js">
function beforeDrawDataPointLabel( dph, label, icsc )
{
label.getCaption().setValue("XX");
}
</pre>
<p>Some idea?</p>
<p> </p>
<p>Thaks!</p>
Find more posts tagged with
Comments
There are no comments yet