How to set Legend with Open Flash Chart 2 graphic using Open source Java API - JOFC?
I have a Seam 2.2 app running under JBoss5.1. In this application I have successfully developed some Graphics using Java Open Flash Chart, which is a Java API for Open Flash Chart.
Now I would like to add a X and Y legend like this one.
Well I have a graphic which is rendering properly and than I try to set X Label using:
... chart.setXLegend(new Text("Legenda X"));
But than instead of showing the legend it corrupts something which causes the graphic to renders completely blank.
This is the generated JSon when the graphics renders correctly.
{"y_axis":{"min":388,"max":866,"steps":20},"title":{"text":"Gráfico de gasto mensal com Combustível"},"bg_colour":"#FFFFFF","is_decimal_separator_comma":0,"elements":[{"values":[{"tip":"R$:610.0\n05/2010","top":610},{"tip":"R$:488.0\n06/2010","top":488},{"tip":"R$:634.57\n07/2010","top":634.57},{"tip":"R$:766.0\n08/2010","top":766},{"tip":"R$:396.0\n09/2010","top":396},{"tip":"R$:610.0\n10/2010","top":610}],"type":"bar"}],"num_decimals":2,"is_fixed_num_decimals_forced":0,"x_axis":{"labels":{"labels":["05/2010","06/2010","07/2010","08/2010","09/2010","10/2010"]}},"is_thousand_separator_disabled":0}
I took a deeply look at it and turns out that whenever I try to add the x legend with the code fragment showed above the JSon is actually NOT generated by JOFC.
I could not find much useful documentation on JOFC on the web and the API itself is not very well documented, so I am completely lost on trying to add this simple x label, which should be 开发者_C百科the easiest part :( . Any Ideas on that.
An update:
Now I just have downloaded JOFC source code and will take a look at this.
It looks like there's an open issue on the JOFC page: http://code.google.com/p/jofc2/issues/detail?id=29
It suggests a workaround of calling the function like:
chart.setXLegend(new Text("Legenda X", Text.TEXT_ALIGN_CENTER))
I would try with Open Flash Grapix, it is easier to use, and just sets parameters on FlashVars.
Open Flash Grapix
精彩评论