Jump to content
We've recently updated our Privacy Statement, available here ×

Set HTML5 chart type with parameter


egeorge

Recommended Posts

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.

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...