You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Andre_Fritsch <an...@siemens.com> on 2007/07/16 23:31:19 UTC
[Trinidad] Chart in output but not displayed?!
Hi!
I tried to create my own trindad chart based on the example. therefore i
created a chart class with this code:
package mypack;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.faces.component.UIComponent;
import org.apache.myfaces.trinidad.component.core.data.CoreChart;
import org.apache.myfaces.trinidad.model.ChartModel;
public class MyChartBean implements java.io.Serializable{
private UIComponent _editedComponent;
private final ChartModel _chartModel = new MyChartModel();
public void setComponent(UIComponent component)
{
_editedComponent = component;
}
public UIComponent getComponent()
{
return _editedComponent;
}
public ChartModel getValue()
{
return _chartModel;
}
private class MyChartModel extends ChartModel
{
public List getGroupLabels() {
// TODO Auto-generated method stub
return _groupLabels;
}
public List getSeriesLabels() {
// TODO Auto-generated method stub
return _seriesLabels;
}
public List getYValues() {
// TODO Auto-generated method stub
return _chartYValues;
}
public Double getMinYValue()
{
CoreChart chart = (CoreChart)_editedComponent;
return 0.0;
}
public Double getMaxYValue()
{
CoreChart chart = (CoreChart)_editedComponent;
return 200000.0;
}
public Double getMaxXValue()
{
return 10.0;
}
public Double getMinXValue()
{
return 6.0;
}
public String getTitle()
{
CoreChart chart = (CoreChart)_editedComponent;
return "Title";
}
public String getSubTitle()
{
CoreChart chart = (CoreChart)_editedComponent;
return "SubTitle";
}
public String getFootNote()
{
CoreChart chart = (CoreChart)_editedComponent;
return "FootNote";
}
public List<List<Double>> getXValues()
{
CoreChart chart = (CoreChart)_editedComponent;
if("XYLine".equals(chart.getType()) ||
"scatterPlot".equals(chart.getType()))
{
return _chartXValues;
}
else
return null;
}
private final List<String> _seriesLabels =
Arrays.asList(new String[]{"Previous", "Target", "Actual"});
private final List<String> _groupLabels =
Arrays.asList(new String[]{"June", "July", "August",
"September","October"});
private final ArrayList<List<Double>> _chartYValues;
private final ArrayList<List<Double>> _chartXValues;
private final ArrayList<List<Double>> _dialchartYValues;
private ArrayList<List<Double>> _largerYValues;
private ArrayList<List<Double>> _largerXValues;
{
_chartYValues = new ArrayList<List<Double>>();
_chartYValues.add(Arrays.asList(new Double[]{135235.0, 155535.0,
141725.0}));
_chartYValues.add(Arrays.asList(new Double[]{106765., 131725.,
127868.}));
_chartYValues.add(Arrays.asList(new Double[]{108456., 119326.,
139326.}));
_chartYValues.add(Arrays.asList(new Double[]{136765., 147265.,
184349.}));
_chartYValues.add(Arrays.asList(new Double[]{107868., 113968.,
174349.}));
_dialchartYValues = new ArrayList<List<Double>>();
_dialchartYValues.add(Arrays.asList(new Double[]{135.}));
_dialchartYValues.add(Arrays.asList(new Double[]{106.}));
_chartXValues = new ArrayList<List<Double>>();
_chartXValues.add(Arrays.asList(new Double[]{6.1, 6.3, 6.5}));
_chartXValues.add(Arrays.asList(new Double[]{6.8, 7.1, 7.3}));
_chartXValues.add(Arrays.asList(new Double[]{7.6, 7.8, 8.0}));
_chartXValues.add(Arrays.asList(new Double[]{8.25, 8.55, 8.78}));
_chartXValues.add(Arrays.asList(new Double[]{9.23, 9.48, 9.88}));
}
}
}
my trinidad page contains this code:
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://myfaces.apache.org/trinidad" prefix="tr" %>
<%@ taglib uri="http://myfaces.apache.org/trinidad/html" prefix="trh" %>
<html>
<head>
<title></title>
</head>
<body>
<f:view>
<tr:outputText value="Hallo Trinidad"></tr:outputText>
<tr:chart id="chart" value="#{chart.value}" binding="#{chart.component}"
inlineStyle="width:680px; height:400px;" gradientsUsed="false"
perspective="false" type="verticalBar" animationDuration="0"
rendered="true"></tr:chart>
</f:view>
</body>
</html>
my faces-Config.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE faces-config PUBLIC
"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config>
<application>
<!-- Use the Trinidad RenderKit -->
<default-render-kit-id>
org.apache.myfaces.trinidad.core
</default-render-kit-id>
</application>
<managed-bean>
<managed-bean-name>
chart</managed-bean-name>
<managed-bean-class>
mypack.MyChartBean</managed-bean-class>
<managed-bean-scope>
request</managed-bean-scope>
</managed-bean>
</faces-config>
and the web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>TrinidatTest</display-name>
<filter>
<filter-name>trinidad</filter-name>
<filter-class>org.apache.myfaces.trinidad.webapp.TrinidadFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>trinidad</filter-name>
<servlet-name>faces</servlet-name>
</filter-mapping>
<servlet>
<servlet-name>faces</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>resources</servlet-name>
<servlet-class>org.apache.myfaces.trinidad.webapp.ResourceServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>faces</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>resources</servlet-name>
<url-pattern>/adf/</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<login-config>
<auth-method>BASIC</auth-method>
</login-config>
</web-app>
when i try to call the trinidad page in my browser. i get empty page, but
the source code contains this svg
<div id="chart" class="af_chart" style="width:680px;
height:400px;"><script>var _AdfWindowOpenError='In Ihrem Browser wurde ein
Blocker für Popup-Fenster ermittelt. Popup Blocker stören die Ausführung
dieser Anwendung. Deaktivieren Sie den Popup Blocker oder lassen Sie Popups
von dieser Site zu.';</script><script
src="/TrinidadTest/adf/jsLibs/Common1_0_1.js"></script><script>var
_locale='de-DE';var _tLocale='de-DE';</script><script
src="/TrinidadTest/adf/jsLibs/resources/LocaleElements_de_DE1_0_1.js"></script><script
src="/TrinidadTest/adf/jsLibs/ApacheChart1_0_1.js"></script><script>ApacheChart.createSVG("chart","svgChartchart","/TrinidadTest/adf/svg/chartNoGradient.svg","width:100%;
height:100%;",null);
var seriesLabels = ['Previous','Target','Actual'];
var groupLabels = ['June','July','August','September','October'];
var seriesColors =
["RGB(231,109,72)","RGB(110,166,243)","RGB(157,206,110)","RGB(252,196,111)","RGB(114,126,142)","RGB(109,44,145)"];
var xValues = null;
var yValues =
[[135235.0,155535.0,141725.0],[106765.0,131725.0,127868.0],[108456.0,119326.0,139326.0],[136765.0,147265.0,184349.0],[107868.0,113968.0,174349.0]];
var model = new ApacheChartModel(seriesLabels, groupLabels, yValues,
xValues, seriesColors);
model.setMinYValue(0.0);
model.setMaxYValue(200000.0);
model.setMinXValue(6.0);
model.setMaxXValue(10.0);
model.setTitle('Title');
model.setSubTitle('SubTitle');
model.setFootNote('FootNote');
var type = 1;
var chartId = 'svgChartchart';
var isPerspective = false;
var legendPosition = 'bottom';
var apacheChart = ApacheChart.createChart(type, model, chartId,
isPerspective, legendPosition);apacheChart.setYMajorGridLineCount(3);
apacheChart.setYMinorGridLineCount(-1);
apacheChart.setXMajorGridLineCount(-1);
apacheChart.setGradientsUsed(false);
apacheChart.setAnimationDuration(0);
apacheChart.setTooltipsVisible(true);
apacheChart.setMaxPrecision(0);
apacheChart.setPartialSubmit(false);
apacheChart.setErrorHtml('<H4>This component needs an SVG enabled browser
like Internet Explorer, Firefox 1.5+ or Opera 9.0+<H4>');
apacheChart.setStatusHtml('<H4><H4>Please Wait. Attempting to load SVG
document...</H4><H4>');
apacheChart.draw();
</script></div>
i compared it to the code generated by the trinidad example an it is
identical!
why does my browser display the example svg and does not display my svg?
André
--
View this message in context: http://www.nabble.com/-Trinidad--Chart-in-output-but-not-displayed-%21-tf4091292.html#a11631390
Sent from the MyFaces - Users mailing list archive at Nabble.com.
Re: [Trinidad] Chart in output but not displayed?!
Posted by Andre_Fritsch <an...@siemens.com>.
Hi Venkata!
Thanks for your help! I found the failure. It was a little star missing in
my web.xml specifying my /adf/* trinidad context.
Regards,
André
ven guddanti wrote:
>
> Hi Andre,
>
> I tried your sample and the only time I am seeing this issue is if I
> create
> a jspx page with your sample in IE. The sample has html, head etc tags
> that
> are not necessary. The following jpsx is working good for me:
>
> <?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
>
> <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
> xmlns:f="http://java.sun.com/jsf/core"
> xmlns:tr="http://myfaces.apache.org/trinidad" >
> <jsp:directive.page contentType="text/html;charset=utf-8"/>
> <f:view>
> <tr:outputText value="Hallo Trinidad"></tr:outputText>
> <tr:chart id="chart" value="#{chart.value}"
> binding="#{chart.component}"
> inlineStyle="width:680px; height:400px;" gradientsUsed="false"
> perspective="false" type="verticalBar" animationDuration="0"
> rendered="true">
> </tr:chart>
> </f:view>
> </jsp:root>
>
> Regards,
> Venkata
>
>
> On 7/16/07, Andre_Fritsch <an...@siemens.com> wrote:
>>
>>
>> Hi!
>>
>> I tried to create my own trindad chart based on the example. therefore i
>> created a chart class with this code:
>>
>> package mypack;
>> import java.util.ArrayList;
>> import java.util.Arrays;
>> import java.util.List;
>>
>> import javax.faces.component.UIComponent;
>>
>> import org.apache.myfaces.trinidad.component.core.data.CoreChart;
>> import org.apache.myfaces.trinidad.model.ChartModel;
>>
>>
>> public class MyChartBean implements java.io.Serializable{
>>
>>
>> private UIComponent _editedComponent;
>> private final ChartModel _chartModel = new MyChartModel();
>>
>> public void setComponent(UIComponent component)
>> {
>> _editedComponent = component;
>> }
>>
>> public UIComponent getComponent()
>> {
>> return _editedComponent;
>> }
>>
>> public ChartModel getValue()
>> {
>> return _chartModel;
>> }
>>
>>
>> private class MyChartModel extends ChartModel
>> {
>> public List getGroupLabels() {
>> // TODO Auto-generated method stub
>> return _groupLabels;
>> }
>>
>> public List getSeriesLabels() {
>> // TODO Auto-generated method stub
>> return _seriesLabels;
>> }
>>
>> public List getYValues() {
>> // TODO Auto-generated method stub
>> return _chartYValues;
>> }
>>
>> public Double getMinYValue()
>> {
>> CoreChart chart = (CoreChart)_editedComponent;
>> return 0.0;
>> }
>>
>> public Double getMaxYValue()
>> {
>> CoreChart chart = (CoreChart)_editedComponent;
>> return 200000.0;
>> }
>>
>>
>> public Double getMaxXValue()
>> {
>>
>> return 10.0;
>> }
>>
>> public Double getMinXValue()
>> {
>> return 6.0;
>> }
>>
>> public String getTitle()
>> {
>> CoreChart chart = (CoreChart)_editedComponent;
>> return "Title";
>> }
>>
>>
>> public String getSubTitle()
>> {
>> CoreChart chart = (CoreChart)_editedComponent;
>> return "SubTitle";
>> }
>>
>> public String getFootNote()
>> {
>> CoreChart chart = (CoreChart)_editedComponent;
>> return "FootNote";
>> }
>>
>> public List<List<Double>> getXValues()
>> {
>> CoreChart chart = (CoreChart)_editedComponent;
>> if("XYLine".equals(chart.getType()) ||
>> "scatterPlot".equals(chart.getType()))
>> {
>> return _chartXValues;
>> }
>> else
>> return null;
>> }
>>
>> private final List<String> _seriesLabels =
>> Arrays.asList(new String[]{"Previous", "Target",
>> "Actual"});
>>
>> private final List<String> _groupLabels =
>> Arrays.asList(new String[]{"June", "July", "August",
>> "September","October"});
>>
>>
>> private final ArrayList<List<Double>> _chartYValues;
>> private final ArrayList<List<Double>> _chartXValues;
>> private final ArrayList<List<Double>> _dialchartYValues;
>> private ArrayList<List<Double>> _largerYValues;
>> private ArrayList<List<Double>> _largerXValues;
>> {
>> _chartYValues = new ArrayList<List<Double>>();
>> _chartYValues.add(Arrays.asList(new Double[]{135235.0, 155535.0,
>> 141725.0}));
>> _chartYValues.add(Arrays.asList(new Double[]{106765., 131725.,
>> 127868.}));
>> _chartYValues.add(Arrays.asList(new Double[]{108456., 119326.,
>> 139326.}));
>> _chartYValues.add(Arrays.asList(new Double[]{136765., 147265.,
>> 184349.}));
>> _chartYValues.add(Arrays.asList(new Double[]{107868., 113968.,
>> 174349.}));
>>
>> _dialchartYValues = new ArrayList<List<Double>>();
>> _dialchartYValues.add(Arrays.asList(new Double[]{135.}));
>> _dialchartYValues.add(Arrays.asList(new Double[]{106.}));
>>
>> _chartXValues = new ArrayList<List<Double>>();
>> _chartXValues.add(Arrays.asList(new Double[]{6.1, 6.3, 6.5}));
>> _chartXValues.add(Arrays.asList(new Double[]{6.8, 7.1, 7.3}));
>> _chartXValues.add(Arrays.asList(new Double[]{7.6, 7.8, 8.0}));
>> _chartXValues.add(Arrays.asList(new Double[]{8.25, 8.55, 8.78}));
>> _chartXValues.add(Arrays.asList(new Double[]{9.23, 9.48, 9.88}));
>> }
>>
>> }
>>
>> }
>>
>>
>>
>> my trinidad page contains this code:
>>
>> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
>> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
>> <%@ taglib uri="http://myfaces.apache.org/trinidad" prefix="tr" %>
>> <%@ taglib uri="http://myfaces.apache.org/trinidad/html" prefix="trh" %>
>> <html>
>> <head>
>> <title></title>
>> </head>
>> <body>
>> <f:view>
>> <tr:outputText value="Hallo
>> Trinidad"></tr:outputText>
>> <tr:chart id="chart" value="#{chart.value}"
>> binding="#{chart.component}"
>> inlineStyle="width:680px; height:400px;" gradientsUsed="false"
>> perspective="false" type="verticalBar" animationDuration="0"
>> rendered="true"></tr:chart>
>> </f:view>
>> </body>
>> </html>
>>
>>
>> my faces-Config.xml
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>>
>> <!DOCTYPE faces-config PUBLIC
>> "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
>> "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
>>
>> <faces-config>
>> <application>
>> <!-- Use the Trinidad RenderKit -->
>> <default-render-kit-id>
>> org.apache.myfaces.trinidad.core
>> </default-render-kit-id>
>> </application>
>> <managed-bean>
>> <managed-bean-name>
>> chart</managed-bean-name>
>> <managed-bean-class>
>> mypack.MyChartBean</managed-bean-class>
>> <managed-bean-scope>
>> request</managed-bean-scope>
>> </managed-bean>
>>
>> </faces-config>
>>
>>
>>
>> and the web.xml
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
>> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
>> <display-name>TrinidatTest</display-name>
>> <filter>
>> <filter-name>trinidad</filter-name>
>>
>> <filter-class>org.apache.myfaces.trinidad.webapp.TrinidadFilter
>> </filter-class>
>> </filter>
>> <filter-mapping>
>> <filter-name>trinidad</filter-name>
>> <servlet-name>faces</servlet-name>
>> </filter-mapping>
>> <servlet>
>> <servlet-name>faces</servlet-name>
>> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
>> <load-on-startup>1</load-on-startup>
>> </servlet>
>> <servlet>
>> <servlet-name>resources</servlet-name>
>>
>> <servlet-class>org.apache.myfaces.trinidad.webapp.ResourceServlet
>> </servlet-class>
>> </servlet>
>> <servlet-mapping>
>> <servlet-name>faces</servlet-name>
>> <url-pattern>*.jsf</url-pattern>
>> </servlet-mapping>
>> <servlet-mapping>
>> <servlet-name>resources</servlet-name>
>> <url-pattern>/adf/</url-pattern>
>> </servlet-mapping>
>> <welcome-file-list>
>> <welcome-file>index.html</welcome-file>
>> <welcome-file>index.htm</welcome-file>
>> <welcome-file>index.jsp</welcome-file>
>> <welcome-file>default.html</welcome-file>
>> <welcome-file>default.htm</welcome-file>
>> <welcome-file>default.jsp</welcome-file>
>> </welcome-file-list>
>> <login-config>
>> <auth-method>BASIC</auth-method>
>> </login-config>
>> </web-app>
>>
>>
>>
>> when i try to call the trinidad page in my browser. i get empty page, but
>> the source code contains this svg
>>
>> <div id="chart" class="af_chart"
>> style="width:680px;
>> height:400px;"><script>var _AdfWindowOpenError='In Ihrem Browser wurde
>> ein
>> Blocker für Popup-Fenster ermittelt. Popup Blocker stören die Ausführung
>> dieser Anwendung. Deaktivieren Sie den Popup Blocker oder lassen Sie
>> Popups
>> von dieser Site zu.';</script><script
>> src="/TrinidadTest/adf/jsLibs/Common1_0_1.js"></script><script>var
>> _locale='de-DE';var _tLocale='de-DE';</script><script
>>
>> src="/TrinidadTest/adf/jsLibs/resources/LocaleElements_de_DE1_0_1.js"></script><script
>> src="/TrinidadTest/adf/jsLibs/ApacheChart1_0_1.js"></script><script>
>> ApacheChart.createSVG
>> ("chart","svgChartchart","/TrinidadTest/adf/svg/chartNoGradient.svg","width:100%;
>> height:100%;",null);
>> var seriesLabels = ['Previous','Target','Actual'];
>> var groupLabels = ['June','July','August','September','October'];
>> var seriesColors =
>>
>> ["RGB(231,109,72)","RGB(110,166,243)","RGB(157,206,110)","RGB(252,196,111)","RGB(114,126,142)","RGB(109,44,145)"];
>> var xValues = null;
>> var yValues =
>> [[135235.0,155535.0,141725.0],[106765.0,131725.0,127868.0],[108456.0,
>> 119326.0,139326.0],[136765.0,147265.0,184349.0],[107868.0,113968.0,
>> 174349.0]];
>> var model = new ApacheChartModel(seriesLabels, groupLabels, yValues,
>> xValues, seriesColors);
>> model.setMinYValue(0.0);
>> model.setMaxYValue(200000.0);
>> model.setMinXValue(6.0);
>> model.setMaxXValue(10.0);
>> model.setTitle('Title');
>> model.setSubTitle('SubTitle');
>> model.setFootNote('FootNote');
>> var type = 1;
>> var chartId = 'svgChartchart';
>> var isPerspective = false;
>> var legendPosition = 'bottom';
>> var apacheChart = ApacheChart.createChart(type, model, chartId,
>> isPerspective, legendPosition);apacheChart.setYMajorGridLineCount(3);
>> apacheChart.setYMinorGridLineCount(-1);
>> apacheChart.setXMajorGridLineCount(-1);
>> apacheChart.setGradientsUsed(false);
>> apacheChart.setAnimationDuration(0);
>> apacheChart.setTooltipsVisible(true);
>> apacheChart.setMaxPrecision(0);
>> apacheChart.setPartialSubmit(false);
>> apacheChart.setErrorHtml('<H4>This component needs an SVG enabled browser
>> like Internet Explorer, Firefox 1.5+ or Opera 9.0+<H4>');
>> apacheChart.setStatusHtml('<H4><H4>Please Wait. Attempting to load SVG
>> document...</H4><H4>');
>> apacheChart.draw();
>>
>> </script></div>
>>
>>
>> i compared it to the code generated by the trinidad example an it is
>> identical!
>> why does my browser display the example svg and does not display my svg?
>>
>> André
>> --
>> View this message in context:
>> http://www.nabble.com/-Trinidad--Chart-in-output-but-not-displayed-%21-tf4091292.html#a11631390
>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>
>>
>
>
--
View this message in context: http://www.nabble.com/-Trinidad--Chart-in-output-but-not-displayed-%21-tf4091292.html#a11653036
Sent from the MyFaces - Users mailing list archive at Nabble.com.
Re: [Trinidad] Chart in output but not displayed?!
Posted by venkata guddanti <ve...@gmail.com>.
Hi Andre,
I tried your sample and the only time I am seeing this issue is if I create
a jspx page with your sample in IE. The sample has html, head etc tags that
are not necessary. The following jpsx is working good for me:
<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:tr="http://myfaces.apache.org/trinidad" >
<jsp:directive.page contentType="text/html;charset=utf-8"/>
<f:view>
<tr:outputText value="Hallo Trinidad"></tr:outputText>
<tr:chart id="chart" value="#{chart.value}" binding="#{chart.component}"
inlineStyle="width:680px; height:400px;" gradientsUsed="false"
perspective="false" type="verticalBar" animationDuration="0"
rendered="true">
</tr:chart>
</f:view>
</jsp:root>
Regards,
Venkata
On 7/16/07, Andre_Fritsch <an...@siemens.com> wrote:
>
>
> Hi!
>
> I tried to create my own trindad chart based on the example. therefore i
> created a chart class with this code:
>
> package mypack;
> import java.util.ArrayList;
> import java.util.Arrays;
> import java.util.List;
>
> import javax.faces.component.UIComponent;
>
> import org.apache.myfaces.trinidad.component.core.data.CoreChart;
> import org.apache.myfaces.trinidad.model.ChartModel;
>
>
> public class MyChartBean implements java.io.Serializable{
>
>
> private UIComponent _editedComponent;
> private final ChartModel _chartModel = new MyChartModel();
>
> public void setComponent(UIComponent component)
> {
> _editedComponent = component;
> }
>
> public UIComponent getComponent()
> {
> return _editedComponent;
> }
>
> public ChartModel getValue()
> {
> return _chartModel;
> }
>
>
> private class MyChartModel extends ChartModel
> {
> public List getGroupLabels() {
> // TODO Auto-generated method stub
> return _groupLabels;
> }
>
> public List getSeriesLabels() {
> // TODO Auto-generated method stub
> return _seriesLabels;
> }
>
> public List getYValues() {
> // TODO Auto-generated method stub
> return _chartYValues;
> }
>
> public Double getMinYValue()
> {
> CoreChart chart = (CoreChart)_editedComponent;
> return 0.0;
> }
>
> public Double getMaxYValue()
> {
> CoreChart chart = (CoreChart)_editedComponent;
> return 200000.0;
> }
>
>
> public Double getMaxXValue()
> {
>
> return 10.0;
> }
>
> public Double getMinXValue()
> {
> return 6.0;
> }
>
> public String getTitle()
> {
> CoreChart chart = (CoreChart)_editedComponent;
> return "Title";
> }
>
>
> public String getSubTitle()
> {
> CoreChart chart = (CoreChart)_editedComponent;
> return "SubTitle";
> }
>
> public String getFootNote()
> {
> CoreChart chart = (CoreChart)_editedComponent;
> return "FootNote";
> }
>
> public List<List<Double>> getXValues()
> {
> CoreChart chart = (CoreChart)_editedComponent;
> if("XYLine".equals(chart.getType()) ||
> "scatterPlot".equals(chart.getType()))
> {
> return _chartXValues;
> }
> else
> return null;
> }
>
> private final List<String> _seriesLabels =
> Arrays.asList(new String[]{"Previous", "Target", "Actual"});
>
> private final List<String> _groupLabels =
> Arrays.asList(new String[]{"June", "July", "August",
> "September","October"});
>
>
> private final ArrayList<List<Double>> _chartYValues;
> private final ArrayList<List<Double>> _chartXValues;
> private final ArrayList<List<Double>> _dialchartYValues;
> private ArrayList<List<Double>> _largerYValues;
> private ArrayList<List<Double>> _largerXValues;
> {
> _chartYValues = new ArrayList<List<Double>>();
> _chartYValues.add(Arrays.asList(new Double[]{135235.0, 155535.0,
> 141725.0}));
> _chartYValues.add(Arrays.asList(new Double[]{106765., 131725.,
> 127868.}));
> _chartYValues.add(Arrays.asList(new Double[]{108456., 119326.,
> 139326.}));
> _chartYValues.add(Arrays.asList(new Double[]{136765., 147265.,
> 184349.}));
> _chartYValues.add(Arrays.asList(new Double[]{107868., 113968.,
> 174349.}));
>
> _dialchartYValues = new ArrayList<List<Double>>();
> _dialchartYValues.add(Arrays.asList(new Double[]{135.}));
> _dialchartYValues.add(Arrays.asList(new Double[]{106.}));
>
> _chartXValues = new ArrayList<List<Double>>();
> _chartXValues.add(Arrays.asList(new Double[]{6.1, 6.3, 6.5}));
> _chartXValues.add(Arrays.asList(new Double[]{6.8, 7.1, 7.3}));
> _chartXValues.add(Arrays.asList(new Double[]{7.6, 7.8, 8.0}));
> _chartXValues.add(Arrays.asList(new Double[]{8.25, 8.55, 8.78}));
> _chartXValues.add(Arrays.asList(new Double[]{9.23, 9.48, 9.88}));
> }
>
> }
>
> }
>
>
>
> my trinidad page contains this code:
>
> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
> <%@ taglib uri="http://myfaces.apache.org/trinidad" prefix="tr" %>
> <%@ taglib uri="http://myfaces.apache.org/trinidad/html" prefix="trh" %>
> <html>
> <head>
> <title></title>
> </head>
> <body>
> <f:view>
> <tr:outputText value="Hallo
> Trinidad"></tr:outputText>
> <tr:chart id="chart" value="#{chart.value}"
> binding="#{chart.component}"
> inlineStyle="width:680px; height:400px;" gradientsUsed="false"
> perspective="false" type="verticalBar" animationDuration="0"
> rendered="true"></tr:chart>
> </f:view>
> </body>
> </html>
>
>
> my faces-Config.xml
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <!DOCTYPE faces-config PUBLIC
> "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
> "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
>
> <faces-config>
> <application>
> <!-- Use the Trinidad RenderKit -->
> <default-render-kit-id>
> org.apache.myfaces.trinidad.core
> </default-render-kit-id>
> </application>
> <managed-bean>
> <managed-bean-name>
> chart</managed-bean-name>
> <managed-bean-class>
> mypack.MyChartBean</managed-bean-class>
> <managed-bean-scope>
> request</managed-bean-scope>
> </managed-bean>
>
> </faces-config>
>
>
>
> and the web.xml
>
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
> <display-name>TrinidatTest</display-name>
> <filter>
> <filter-name>trinidad</filter-name>
>
> <filter-class>org.apache.myfaces.trinidad.webapp.TrinidadFilter
> </filter-class>
> </filter>
> <filter-mapping>
> <filter-name>trinidad</filter-name>
> <servlet-name>faces</servlet-name>
> </filter-mapping>
> <servlet>
> <servlet-name>faces</servlet-name>
> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
> <load-on-startup>1</load-on-startup>
> </servlet>
> <servlet>
> <servlet-name>resources</servlet-name>
>
> <servlet-class>org.apache.myfaces.trinidad.webapp.ResourceServlet
> </servlet-class>
> </servlet>
> <servlet-mapping>
> <servlet-name>faces</servlet-name>
> <url-pattern>*.jsf</url-pattern>
> </servlet-mapping>
> <servlet-mapping>
> <servlet-name>resources</servlet-name>
> <url-pattern>/adf/</url-pattern>
> </servlet-mapping>
> <welcome-file-list>
> <welcome-file>index.html</welcome-file>
> <welcome-file>index.htm</welcome-file>
> <welcome-file>index.jsp</welcome-file>
> <welcome-file>default.html</welcome-file>
> <welcome-file>default.htm</welcome-file>
> <welcome-file>default.jsp</welcome-file>
> </welcome-file-list>
> <login-config>
> <auth-method>BASIC</auth-method>
> </login-config>
> </web-app>
>
>
>
> when i try to call the trinidad page in my browser. i get empty page, but
> the source code contains this svg
>
> <div id="chart" class="af_chart"
> style="width:680px;
> height:400px;"><script>var _AdfWindowOpenError='In Ihrem Browser wurde ein
> Blocker für Popup-Fenster ermittelt. Popup Blocker stören die Ausführung
> dieser Anwendung. Deaktivieren Sie den Popup Blocker oder lassen Sie
> Popups
> von dieser Site zu.';</script><script
> src="/TrinidadTest/adf/jsLibs/Common1_0_1.js"></script><script>var
> _locale='de-DE';var _tLocale='de-DE';</script><script
>
> src="/TrinidadTest/adf/jsLibs/resources/LocaleElements_de_DE1_0_1.js"></script><script
> src="/TrinidadTest/adf/jsLibs/ApacheChart1_0_1.js"></script><script>
> ApacheChart.createSVG
> ("chart","svgChartchart","/TrinidadTest/adf/svg/chartNoGradient.svg","width:100%;
> height:100%;",null);
> var seriesLabels = ['Previous','Target','Actual'];
> var groupLabels = ['June','July','August','September','October'];
> var seriesColors =
>
> ["RGB(231,109,72)","RGB(110,166,243)","RGB(157,206,110)","RGB(252,196,111)","RGB(114,126,142)","RGB(109,44,145)"];
> var xValues = null;
> var yValues =
> [[135235.0,155535.0,141725.0],[106765.0,131725.0,127868.0],[108456.0,
> 119326.0,139326.0],[136765.0,147265.0,184349.0],[107868.0,113968.0,
> 174349.0]];
> var model = new ApacheChartModel(seriesLabels, groupLabels, yValues,
> xValues, seriesColors);
> model.setMinYValue(0.0);
> model.setMaxYValue(200000.0);
> model.setMinXValue(6.0);
> model.setMaxXValue(10.0);
> model.setTitle('Title');
> model.setSubTitle('SubTitle');
> model.setFootNote('FootNote');
> var type = 1;
> var chartId = 'svgChartchart';
> var isPerspective = false;
> var legendPosition = 'bottom';
> var apacheChart = ApacheChart.createChart(type, model, chartId,
> isPerspective, legendPosition);apacheChart.setYMajorGridLineCount(3);
> apacheChart.setYMinorGridLineCount(-1);
> apacheChart.setXMajorGridLineCount(-1);
> apacheChart.setGradientsUsed(false);
> apacheChart.setAnimationDuration(0);
> apacheChart.setTooltipsVisible(true);
> apacheChart.setMaxPrecision(0);
> apacheChart.setPartialSubmit(false);
> apacheChart.setErrorHtml('<H4>This component needs an SVG enabled browser
> like Internet Explorer, Firefox 1.5+ or Opera 9.0+<H4>');
> apacheChart.setStatusHtml('<H4><H4>Please Wait. Attempting to load SVG
> document...</H4><H4>');
> apacheChart.draw();
>
> </script></div>
>
>
> i compared it to the code generated by the trinidad example an it is
> identical!
> why does my browser display the example svg and does not display my svg?
>
> André
> --
> View this message in context:
> http://www.nabble.com/-Trinidad--Chart-in-output-but-not-displayed-%21-tf4091292.html#a11631390
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>