Hitachi Vantara Pentaho Community Forums
Results 1 to 2 of 2

Thread: Edit Properties within a Chart

  1. #1
    Join Date
    May 2017

    Default Edit Properties within a Chart

    Good morning all,

    Guess who's trying to learn more by working through a new report setup...

    Bar Chart is setup, populates and works ...mostly fine
    I have a Query (report_type) that returns either '500_and_Over', OR 'Under_500'
    I have a param (overorunder500_var) that is linked to this Query
    When you launch the report, you can select either 500+ or Under 500, and the chart is populated (side Thank You to Member Deanicus for their help here the other day)

    Within the Bar Chart itself, under the available options is y-scale-factor, y-tick-interval, etc... I would LIKE when '500_and_Over' is selected, these properties will set to 1000.0 and 1000.0. And when selecting 'Under_500', properties would be scale=500.0 and interval = 100.0

    What I can and cannot do:
    For this particular Chart Property(s), when selecting the Edit Property, does NOT contain a "formula wizard" ... that's fine, I can write a C#\C++ line in VS and make it work, BUT I apparently cannot write one in PRD freehand ... spent most of yesterday trying different formula configurations, but no luck. There is an 'OK' button on the Edit Properties box that no matter what I try, just will NOT activate so I can click it... 'Cancel' is my only option.

    This is mostly what I have been trying in the y-scale-factor properties... =IF([overorunder500_var]="500_and_over"; "1000.0" ; "500.0" ; ) ((many iterations... just not the right one yet))
    What am I doing wrong (Nice question huh.)
    Am I trying to read off a param that I cannot "see" from within the Chart?
    Do I need to select a different variable or add a query or select a different field\choice before the Edit Properties box will see I have an If\Else statement in there?

    Thanks in advance for any assistance

  2. #2
    Join Date
    May 2017


    Apparently, from what I have found reading Pentaho documentation and scouring the web for any workarounds...

    You cannot make line item edits to ANY FIELD that does not contain a "formula wizard" within the Edit Property.

    BUT, you can learn beanshell, and write a Chart Post-Processing Script:

    import org.jfree.chart.plot.CategoryPlot;
    import org.jfree.chart.axis.ValueAxis;
    import java.util.*;
    import java.math.*;
    import java.util.List;
    import java.util.ArrayList;

    CategoryPlot chartPlot = chart.getCategoryPlot();
    ValueAxis yAxis= chartPlot.getRangeAxis();
    data = chartPlot.getDataset();
    keys = data.getRowKeys();
    ArrayList dataVals = new ArrayList();
    for (int i=0;i<keys.size();i++)
    Double maxVale=(Collections.max(dataVals)).doubleValue();
    Double minVale=(Collections.min(dataVals)).doubleValue();

    and insert all that information into your Chart Properties:

    Name:  example1a.jpg
Views: 162
Size:  13.5 KB

    And while it isn't exactly what I was looking for, it IS a workaround.

    And now you know too.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.