PDA

View Full Version : Change the chart legend font size



tanny
06-01-2007, 05:25 AM
Hi all !Does anyone know how to change the font size of the legend of a chart in the widget.xml file? Indeed I tried :

<legend><font><size>5</size></font></legend>

and

<legendFont>Arial-5</legendFont>

and

<legend-font><size>5</size> </legend-font>

But it doesnt work.

I use
ChartHelper.doPieChart( "gisd", "SSD", "cases.widget.xml", parameters, content, userSession, messages, null );

in a jsp page to display my chart.

Can you help me?
Thanks a lot.

Tanny

ingo.klose
06-01-2007, 11:24 AM
Hi tanny

I think it is not implemented, but I haven't checked the source code.

I just put some source code on JIRA that implements exactly what you are asking for. Unfortunately not for the chart widgets implementation but the chart component implementation. (The one you use when you use the chart action in the Design Studio).

Have a look at http://jira.pentaho.org:8080/browse/PLATFORM-1003

In the zip file you'll find the source code and some xations that show how you can configure the fonts. Like I said it does not work with the widgets, but from what I know you can also use one of the do...-methods to execute my kind of xaction, too, to display graphs.

Hope it helps.

All the best,
Ingo

tanny
06-01-2007, 12:12 PM
Hey it seems hard but thanks anyway!

rider
06-04-2007, 12:08 PM
Hi

Your added features is very interesting.
How can I get your java compiled or get those .class files for use.



Hi tanny

In the zip file you'll find the source code and some xations that show how you can configure the fonts. Like I said it does not work with the widgets, but from what I know you can also use one of the do...-methods to execute my kind of xaction, too, to display graphs.

Hope it helps.

All the best,
Ingo

ingo.klose
06-04-2007, 12:17 PM
Hi,

you can download the pentaho sources from the svn and then exchange my files with the originals and build it all.

There is a guide that explains how to set up Eclipse for debugging and building: http://downloads.sourceforge.net/pentaho/Building_and_Debugging_Pentaho_with_Eclipse-1.5.3.pdf?modtime=1177507245&big_mirror=0

All the best,
Ingo

rider
06-05-2007, 12:36 PM
Hi Ingo

Which version of pentaho your code apply to.
I try it with 1.5.2 and it cause the error

javax.servlet.ServletException: org/pentaho/plugin/jfreechart/PieDatasetChartDefinition (Unsupported major.minor version 49.0)

ingo.klose
06-05-2007, 12:48 PM
Hi,

I tested the code with 1.5.2 and 1.5.3.

The error above hints that your code is not compliant to the JRE with which you run Pentaho.

I think you have two options:

- Set the JDK compliance in the Eclipse Project Settings and recompile.
or
- Change the start.bat /start.sh to use a JRE that fits to the one of your compiler.

I ran into the same problem and could fix it both ways.

rider
06-05-2007, 11:59 PM
Hi

I changed JRE in pentaho-demo and the code works. I can view new chart in the viewAction test page.
But, when i use it in the html page, nothing appears. Outputstream seems to be empty.

I called ChartHelper.doAction() to execute the component as in the SampleDashboard

<%
parameters = new SimpleParameterProvider();
ByteArrayOutputStream outputStream2 = new ByteArrayOutputStream();
messages = new ArrayList();

ChartHelper.doAction( "ACB", "Report", "BarChartComponent.xaction", "NewBarChart", parameters, outputStream2 , userSession, messages, null );
%>
<span style="font-family:Arial;font-size:12;font-weight:plain"> New Bar test</span>
<% out.write( outputStream2.toString() ); %>

Could you clarify how to use new component in dashboard?

ingo.klose
06-06-2007, 03:43 AM
Hi,

I always use the Pentaho AJAX API for my dashboards, so I don't really know much about the doAction method.

If there are no error messages, you might want to run the whole thing whith the other doAction-method and check out what the status of iRuntimeContext and if you can get the content from there.

If that doesn't work you can use Eclipse's debug mode to see what is written into the outputStream.

All the best,
Ingo

ingo.klose
06-06-2007, 04:55 AM
One more thing, make sure you define an output in your action sequence for the image-tag.

In the action definition of the Chart component:


<action-outputs>
<image-tag type="string"/>
</action-outputs>


and for the action sequence



<outputs>
<image-tag type="string"/>
</outputs>

rider
06-06-2007, 05:08 AM
Hi Ingo

Indeed, there is no error. I am not sure how to debug the code from Eclipse.
I will try ajax API as well

Thanks alot for your help

dgambin
06-18-2008, 08:12 AM
Hi,

I am using Pentaho PCI version 1.6.1. I can't set legend font size either. Besides, I have encoding problem since the legend text is not displayed correctly.

Can you please tell me if legend-font functionality is built into this version (or some other)?

And how should I encode the text being shown in legend? I have chart data coming from a SQL Lookup Rule, the column header is written in UTF8 and all my data is in UTF8. Everything works except legend text that displays weird characters instead of my special Croatian characters. Everything is set in .xaction file.

thanks very much

regards, dejan