Search code examples
pentahopentaho-cde

Pentaho: logarithmic scale in charts


Is there a way to set a "logarithmic scale" in a Pentaho chart? Result from my sql query has a very wide range (from 1 to 1000000).

I could change my sql query to something like this:

"Select LOG(10, wide_value)..."

But Y-axis scale changes the same way at Pentaho chart (1,2,3...). I need the original labels on Pentaho chart (10,100,1000...).

What I found on web are old forums talking about that this is still a feature request, or to try with "CCC" (too much documentation for something too simple) or to modify the source code (even worse). None of them useful.

Hint: I'm using a legacy implementation on Pentaho bi-server 6.0. If there is an option on newer versions it will be useful too, maybe there is something similar on my old version.


Solution

  • This is the solution in case someone else needs it. My query originally delivered something like:

    Select
       x_axis as "x_axis",
       y_axis_wide_value as "value"
    From ...
    

    It must be modified to:

    Select
        x_axis as "x_axis",
        LOG(10, y_axis_wide_value) as "value"
    From ...
    

    My graphic in Pentaho's "Components Panel" is a "CCC Line Chart".

    What I needed is for the Y axis to show the real values. That is achieved as follows: In "Advanced Properties" you must locate "OrthoAxisThickFormatter" and enter the following function:

    function fun (value)
    {
         return Math.pow (10, value);
    }
    

    Some additional settings for better viewing:

    orthoAxisOriginIsZero: false
    orthoAxisZeroLine: false
    

    And that was all. Now my graphs are displayed with logarithmic scale.