Set HTML5 chart type with parameter

0

I have an HTML5 chart in my report and I want to set the default type from a parameter, but still allow the gear-dropdown to change the type afterwards.

I am using Visualize.js to embed my report into another application.

My jrxml defines the chart in this way:

<hc:chart type="Pie" xmlns:hc="http://jaspersoft.com/highcharts" xsi:schemalocation="http://jaspersoft.com/highcharts http://jaspersoft.com/schema/highcharts.xsd">
  <hc:chartsetting name="default">
    <hc:chartproperty name="chart.type">
      <hc:propertyexpression><!--[CDATA[$P{chartTypeParam}]]--></hc:propertyexpression>
    </hc:chartproperty>
  </hc:chartsetting>

Where chartTypeParam is the parameter passed into the report.

This works fine to set the default type of the chart. But when I then use the gear menu dropdown in the rendered report to change the type, it just reloads with the same value that was passed in as a parameter.

I want the parameter to define only the default, and still allow the user to select a new type afterwards.

I can get around this problem by making a copy of the chart element for every type I want, then hiding all but one chart as specified by the parameter, but that is horrific and unmaintainable. I would have to have the same configuration code 6 different times.

Any advice would be helpful.

egeorge's picture
Joined: Jun 5 2012 - 2:36pm
Last seen: 10 months 1 day ago

0 Answers:

No answers yet
Feedback