You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Dustin Frazier <du...@philanthropix.org> on 2003/10/22 01:53:41 UTC
help with dynamic chart question
I'm working on a custom chart component (using Quest's chart library) that's
nearly identical to the chart code in the workbench example. My only
additional requirement is that I need to have multiple (dynamic) charts per
page. So, going with the page as the IChartProvider as in the workbench
example won't work. I've created a component called Chart which I want to use
as the provider of the meta-data for the chart.
Currently, I have a page template with something like:
<span jwcid="@Chart" meta="ognl:chartMeta"/>
The getChartMeta() method on the page makes a database query and creates a
meta-data structure for the given chart. My initial thinking was to just have
the 'meta' property on my Chart component, and have the getChart() method
(from IChartProvider) in my Chart.java return getMeta(). This didn't work,
presumably because the ChartService is handled in a separate request context
from the actual rendering of the page, so the value of the 'meta' property on
Chart is null when the ChartService asks for it.
I tried adding a persistent property to the Chart component and setting it
whenever the 'meta' parameter was set to a non-null value, but this led to the
dreaded "page recorder is locked after commit" error when I hit the page a
second time.
Any thoughts on the best way to make the workbench chart code allow multiple
distinct charts per page? Thanks in advance...
Dustin
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: help with dynamic chart question
Posted by Harish Krishnaswamy <hk...@comcast.net>.
I have done exactly this for a project at work recently and here's what
I did...
I have a Chart component like you do that basically takes in a ChartData
(the object that provides the data for the chart) and a ChartProvider
(the object that provides the right kind of chart - Bar, Line, XY etc)
as parameters and the ChartService encodes the qualified class names in
addition to the query criteria into the service parameters. When the
browser makes a request for the image, the ChartService decodes the
parameters instantiates the objects and builds the graph dynamically and
renders it.
Let me know if this doesn't make sense or need more info.
-Harish
Dustin Frazier wrote:
>I'm working on a custom chart component (using Quest's chart library) that's
>nearly identical to the chart code in the workbench example. My only
>additional requirement is that I need to have multiple (dynamic) charts per
>page. So, going with the page as the IChartProvider as in the workbench
>example won't work. I've created a component called Chart which I want to use
>as the provider of the meta-data for the chart.
>
>Currently, I have a page template with something like:
>
><span jwcid="@Chart" meta="ognl:chartMeta"/>
>
>The getChartMeta() method on the page makes a database query and creates a
>meta-data structure for the given chart. My initial thinking was to just have
>the 'meta' property on my Chart component, and have the getChart() method
>(from IChartProvider) in my Chart.java return getMeta(). This didn't work,
>presumably because the ChartService is handled in a separate request context
>from the actual rendering of the page, so the value of the 'meta' property on
>Chart is null when the ChartService asks for it.
>
>I tried adding a persistent property to the Chart component and setting it
>whenever the 'meta' parameter was set to a non-null value, but this led to the
>dreaded "page recorder is locked after commit" error when I hit the page a
>second time.
>
>Any thoughts on the best way to make the workbench chart code allow multiple
>distinct charts per page? Thanks in advance...
>
>Dustin
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
RE: help with dynamic chart question
Posted by Dustin Frazier <du...@philanthropix.org>.
As a follow up to this...
I have my Chart component within a Foreach, so each chart I'm showing is
parameterized by a particular value (imagine charts for expenses, revenue,
etc. for a single company). The code in my page looks like:
<span jwcid="keylist@Foreach" source="ognl:benchmarkKeys">
<span jwcid="@Chart"
meta="ognl:getChartMetaForBenchmark(components.keylist.value)"/>
</span>
Everything else (ChartService, ChartAsset, etc.) is pretty much like the
example from the workbench. What I'm seeing is that all the charts on the
page are exactly the same. When I look at the source for the page, all of the
img tags have the same src:
<img src="/app?service=chart/Benchmark/$Chart">
Based on the code in ChartService and ChartAsset, I would have assumed that
the service context would be unique for each instance of my Chart component,
since it encodes the idPath of the component within the page. Not true? How
should I "address" each instance of my Chart component so that each call to
the ChartService gets a unique ChartMeta?
Hope this makes sense to *someone* out there...
Dustin
-----Original Message-----
From: Dustin Frazier [mailto:dustin@philanthropix.org]
Sent: Tuesday, October 21, 2003 4:54 PM
To: tapestry-user@jakarta.apache.org
Subject: help with dynamic chart question
I'm working on a custom chart component (using Quest's chart library) that's
nearly identical to the chart code in the workbench example. My only
additional requirement is that I need to have multiple (dynamic) charts per
page. So, going with the page as the IChartProvider as in the workbench
example won't work. I've created a component called Chart which I want to use
as the provider of the meta-data for the chart.
Currently, I have a page template with something like:
<span jwcid="@Chart" meta="ognl:chartMeta"/>
The getChartMeta() method on the page makes a database query and creates a
meta-data structure for the given chart. My initial thinking was to just have
the 'meta' property on my Chart component, and have the getChart() method
(from IChartProvider) in my Chart.java return getMeta(). This didn't work,
presumably because the ChartService is handled in a separate request context
from the actual rendering of the page, so the value of the 'meta' property on
Chart is null when the ChartService asks for it.
I tried adding a persistent property to the Chart component and setting it
whenever the 'meta' parameter was set to a non-null value, but this led to the
dreaded "page recorder is locked after commit" error when I hit the page a
second time.
Any thoughts on the best way to make the workbench chart code allow multiple
distinct charts per page? Thanks in advance...
Dustin
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org