Label of legend entries
Options
Hi,
I got some problems settings the labels in legend for a multi-line-chart.
I got multiple y-series with additional title information applied. When I use no grouping everything works fine and these titles are displayed...but when I add some additional grouping, only the grouping value is displayed. Is it possible to add the series title the legend entries. I tried to modify the values via script but I don't have information about the current series there...So, is there any chance to do this? I could imagine the following output in the legend.
X <series-identifier1> - <groupvalue1>
Or is it possible to add 2 legends. One for the symbols or different line styles to explain/identify the different y-series and one for the coloring to explain the groupings?
Thanks,
Ingo
I got some problems settings the labels in legend for a multi-line-chart.
I got multiple y-series with additional title information applied. When I use no grouping everything works fine and these titles are displayed...but when I add some additional grouping, only the grouping value is displayed. Is it possible to add the series title the legend entries. I tried to modify the values via script but I don't have information about the current series there...So, is there any chance to do this? I could imagine the following output in the legend.
X <series-identifier1> - <groupvalue1>
Or is it possible to add 2 legends. One for the symbols or different line styles to explain/identify the different y-series and one for the coloring to explain the groupings?
Thanks,
Ingo
0
Comments
-
Hi,
thanks for the quick answer, but unfortunately this doesn't solve my problem. In your example you have only one column for the values. In my case I got multiple which leads to multiple series...
For example, I got values from different places for specific items
Item; Time; value1; value2
A;500ms; null; 8
A; 700ms; 5;null
B; 750ms; 20; null
...
X-Axis -> Time
Grouping on Item
2 Series: 1. value1, 2. value2
Now, the legend should display:
<Symbol for series1> <Label for series 1 > <Item>
<Symbol for series2> <Label for series 2 > <Item>
Thanks,
Ingo0 -
Ingo,
I am not certain this can be done.
You could have the legend show up like
symbol for item a label for a
symbol for item b label for b
_________Separator
symbol for item a label for a
symbol for item b label for b
Where the separator shows up once and above is series one and below is series two.
Jason0 -
Hi,
thats exactly what I got right now...but because if up to 6 series its hard to "remember" what one series represents...Is it possible to change the appearance of the separator so I could display a text for the series? ;-)
or is it possible to add another legend for the series?
Thanks,
Ingo0 -
Ingo,
This is a tough one. I suggest you log a bugzilla entry for this. You may also be able to add some script like
var series_number = 0;
function beforeDrawLegendItem(lerh, bounds, icsc)
{
if( lerh.getDataIndex() == 0 ){
series_number +=1 ;
}
var old_label =lerh.getLabel().getCaption().getValue();
lerh.getLabel().getCaption().setValue(old_label + " -- Ser" + series_number);
}
Jason0 -
Ingo,
Try something like:
importPackage(Packages.java.util);
importPackage(Packages.org.eclipse.birt.chart.model.data.impl);
importPackage(Packages.org.eclipse.birt.chart.model.component.impl);
importPackage(Packages.org.eclipse.birt.chart.model.type.impl);
var cm = icsc.getChartInstance();
var xAxis = cm.getAxes().get(0);
var yAxis = xAxis.getAssociatedAxes().get(0);
var yser1 = yAxis.getSeriesDefinitions().get(0).getDesignTimeSeries().getSeriesIdentifier();
var yser2 = yAxis.getSeriesDefinitions().get(1).getDesignTimeSeries().getSeriesIdentifier();
if( lerh.getDataIndex() == 0 ){
series_number +=1 ;
}
var old_label =lerh.getLabel().getCaption().getValue();
if( series_number == 1 ){
lerh.getLabel().getCaption().setValue(old_label + yser1);
}else{
lerh.getLabel().getCaption().setValue(old_label + yser2);
}
}0 -
Hi,
since I haven't done scripting till now. Do I any more prerequisites to run this script? Do I need to copy more libraries or something like that to the tomcat?
As soon as I run the following method in the script I get a null-pointer-exception.
importPackage(Packages.java.util);
importPackage(Packages.org.eclipse.birt.chart.model.data.impl);
importPackage(Packages.org.eclipse.birt.chart.model.component.impl);
importPackage(Packages.org.eclipse.birt.chart.model.type.impl);
function beforeDrawLegendItem(lerh, bounds, icsc)
{
var cm = icsc.getChartInstance();
}
-->
null ( 1 time(s) )
detail : org.eclipse.birt.chart.exception.ChartException
at org.eclipse.birt.chart.reportitem.ChartReportItemPresentationImpl.onRowSets(ChartReportItemPresentationImpl.java:607)
at org.eclipse.birt.report.engine.presentation.LocalizedContentVisitor.processExtendedContent(LocalizedContentVisitor.java:772)
at org.eclipse.birt.report.engine.presentation.LocalizedContentVisitor.visitForeign(LocalizedContentVisitor.java:414)
at org.eclipse.birt.report.engine.content.impl.ForeignContent.accept(ForeignContent.java:59)
...
Caused by: java.lang.NullPointerException
at org.eclipse.birt.chart.script.ScriptHandler.convertException(ScriptHandler.java:1128)
at org.eclipse.birt.chart.script.ScriptHandler.register(ScriptHandler.java:1085)
at org.eclipse.birt.chart.reportitem.ChartReportItemPresentationImpl.onRowSets(ChartReportItemPresentationImpl.java:465)
... 99 more
Thanks,
Ingo0 -
Okay,
it runs now. I don't know why but I created the same chart again and now it works, in generally. The problem I got now is, that in another chart, I got multiple y-Axis. I tried the following but unfortunately got always the same label...
mportPackage(Packages.java.util);
importPackage(Packages.org.eclipse.birt.chart.model.data.impl);
importPackage(Packages.org.eclipse.birt.chart.model.component.impl);
importPackage(Packages.org.eclipse.birt.chart.model.type.impl);
var cm = icsc.getChartInstance();
var xAxis = cm.getAxes().get(0);
var yAxis = xAxis.getAssociatedAxes().get(0);
var yAxis1 = xAxis.getAssociatedAxes().get(1);
var yAxis2 = xAxis.getAssociatedAxes().get(2);
var yser1 = yAxis.getSeriesDefinitions().get(0).getDesignTimeSeries().getSeriesIdentifier();
var yser2 = yAxis1.getSeriesDefinitions().get(0).getDesignTimeSeries().getSeriesIdentifier();
var yser3 = yAxis2.getSeriesDefinitions().get(0).getDesignTimeSeries().getSeriesIdentifier();
if( lerh.getDataIndex() == 0 ){
series_number +=1 ;
}
var old_label =lerh.getLabel().getCaption().getValue();
switch ( series_number ) {
case 1: lerh.getLabel().getCaption().setValue(yser1 + " - " + old_label); break;
case 2: lerh.getLabel().getCaption().setValue(yser2 + " - " + old_label); break;
case 3: lerh.getLabel().getCaption().setValue(yser3 + " - " + old_label); break;
default:
}
}
Any suggestion? Thanks.
Ingo0
Categories
- All Categories
- 111 Developer Announcements
- 49 Articles
- 103 General Questions
- 123 IM Services
- 40 OpenText Hackathon
- 31 Developer Tools
- 20.6K Analytics
- 4.1K AppWorks
- 8.9K Extended ECM
- 897 Cloud Fax and Notifications
- 77 Digital Asset Management
- 9.3K Documentum
- 29 eDOCS
- 123 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management
- 1 XM Fax