Hitachi Vantara Pentaho Community Forums
Results 1 to 4 of 4

Thread: Problem with dial

  1. #1

    Default Problem with dial

    I'm trying to adapt the sample dashboard to my dashboard

    The code is
    Code:
    <action-sequence> 
      <title>Yearly Gross Sales DialChart</title>
      <version>1</version>
      <logging-level>DEBUG</logging-level>
      <documentation> 
        <result-type>chart</result-type>  
        <description>Dial Chart with the the current year sales</description> 
      </documentation>
    
      <inputs/>
    
      <outputs> 
        <image-tag type="string"> 
          <destinations> 
            <response>content</response> 
          </destinations> 
        </image-tag> 
      </outputs>
    
      <resources/>
      
      <actions> 
        <action-definition> 
          <component-name>SQLLookupRule</component-name>
          <action-type>Relational</action-type>
          <action-inputs/>
          <action-outputs> 
            <query-result type="result-set" mapping="query_result"/> 
          </action-outputs>
          <component-definition> 
            <jndi><![CDATA[dataTable]]></jndi>  
            <live><![CDATA[true]]></live>  
            <query><![CDATA[select VALOR,INF as minimum,SUP as maximum from tabledw]]></query> 
          </component-definition> 
        </action-definition>
      
        <action-definition> 
          <component-name>JavascriptRule</component-name>
          <action-type>JavaScript</action-type>
          <action-inputs> 
            <query_result type="result-set"/> 
          </action-inputs>
          <action-outputs> 
            <salestot type="string"/> 
          </action-outputs>
          <component-definition> 
            <script><![CDATA[salestot = query_result.getValueAt(0,0);]]></script> 
          </component-definition> 
        </action-definition>
      
        <action-definition> 
          <component-name>JavascriptRule</component-name>
          <action-type>JavaScript</action-type>
          <action-inputs> 
            <query_result type="result-set"/> 
          </action-inputs>
          <action-outputs> 
            <minval type="string"/> 
          </action-outputs>
          <component-definition> 
            <script><![CDATA[minval = query_result.getValueAt(0,1);]]></script> 
          </component-definition> 
        </action-definition>
      
        <action-definition> 
          <component-name>JavascriptRule</component-name>
          <action-type>JavaScript</action-type>
          <action-inputs> 
            <query_result type="result-set"/> 
          </action-inputs>
          <action-outputs> 
            <maxval type="string"/> 
          </action-outputs>
          <component-definition> 
            <script><![CDATA[maxval = query_result.getValueAt(0,2);]]></script> 
          </component-definition> 
        </action-definition>
        
            <action-definition> 
          <component-name>ChartComponent</component-name>
          <action-type>Dial Chart</action-type>
          <action-inputs> 
            <chart-data type="result-set" mapping="query_result"/>  
            <salestot type="string"/>  
            <minval type="string"/>  
            <maxval type="string"/> 
          </action-inputs>
          <action-outputs> 
            <image-tag type="string"/> 
          </action-outputs>
          <component-definition>
            <chart-attributes> 
              <chart-type>DialChart</chart-type>  
              <border-visible>true</border-visible>  
              <tick-interval>1</tick-interval>  
              <value-color>#9999bb</value-color>  
              <tick-color>#808080</tick-color>  
              <!-- this is the color of the needle -->  
              <needle-color>#0000FF</needle-color>  
              <plot-background-color>#FFFFFF</plot-background-color>  
              <!-- intervals define ranges on the dial that are colored differently from the dial background -->  
              <interval> 
                <label>over</label>  
                <!-- this is the value that the range starts at -->  
                <minimum>{minval}</minimum>  
                <!-- this is the value that the range stops at -->  
                <maximum>{maxval}</maximum>  
                <!-- this is the color of the range -->  
                <color>#FF0000</color>  
                <!-- this is the color of the text for the range value and tick marks -->  
                <text-color>#bb4040</text-color>  
                <stroke-width>2</stroke-width> 
              </interval>  
              <interval> 
                <label>over</label>  
                <minimum>{minval}</minimum>  
                <maximum>{minval}</maximum>  
                <color>#FFFF00</color>  
                <text-color>#40bb40</text-color>  
                <stroke-width>2</stroke-width> 
              </interval>  
              <interval> 
                <label>over</label>  
                <minimum>{maxval}</minimum>  
                <maximum>{maxval}</maximum>  
                <color>#00FF00</color>  
                <text-color>#40bb40</text-color>  
                <stroke-width>2</stroke-width> 
              </interval> 
            </chart-attributes>  
            <width><![CDATA[160]]></width>  
            <height><![CDATA[160]]></height>  
            <title>Current Year Sales ${salestot} Million</title>  
            <by-row>true</by-row>
          </component-definition> 
        </action-definition>
     
      </actions> 
    </action-sequence>
    SQLLookupRule and the three Javascript Rule works succesfull.

    I get the following error:

    Pentaho BI - Iniciar AcciónFailed[es_161] Error: RuntimeContext.ERROR_0012 - [es_33] ActionDefinition for ChartComponent did not execute successfully (org.pentaho.core.runtime.RuntimeContext)
    Sorry for my bad english, I´m learning
    La Aventura Es La Aventura

  2. #2
    Join Date
    Jul 2007
    Posts
    2,498

    Default

    It's a bit difficult to find the problem like that; Make sure the inputs you are giving to the chartcomponent are defined, that's all I can think off now
    Pedro Alves
    Meet us on ##pentaho, a FreeNode irc channel

  3. #3

    Default

    Hello Althor,

    Have you fixed this problem already? I think you're having a problem on this part:


    <interval>
    <label>over</label>
    <minimum>{minval}</minimum>
    <maximum>{minval}</maximum>
    <color>#FFFF00</color>
    <text-color>#40bb40</text-color>
    <stroke-width>2</stroke-width>
    </interval>
    <interval>
    <label>over</label>
    <minimum>{maxval}</minimum>
    <maximum>{maxval}</maximum>
    <color>#00FF00</color>
    <text-color>#40bb40</text-color>
    <stroke-width>2</stroke-width>
    </interval>



    There must've been a problem with the "<minimum>" and "<maximum>" tags having the same values.

    Try changing those values so that the "<maximum>" value of the first interval would meet the "<minimum>" value of the next. Coz I think there has to be a connection between those two tags. I Hope you got my idea and I hope this works.
    Last edited by roren; 03-19-2008 at 03:09 AM.

  4. #4

    Default Null pointer...

    Althor-

    When I ran the same query (slightly modified for my environment) I got a null pointer exception. I resolved it by moving all of the variable assignments into one javascript block ala:

    Code:
    <![CDATA[
                            salestot = query_result.getValueAt(0,0);
                            minval = query_result.getValueAt(0,1);
                            maxval = query_result.getValueAt(0,2);
                        ]]>
    ...and by assigning fixed values in the select statement ala:

    Code:
    <jndi><![CDATA[DATASOURCENAMEHERE]]></jndi>    
                    <!-- live><![CDATA[true]]></live -->
                    <query><![CDATA[select 1 as value, 0 as minimum,3 as maximum]]></query>
    The problem now is that I don't know which change fixed the problem; is it possible that your data table has null values for VALOR, INF or SUP?

    I would recommend moving all your javascript into a single code block (per my first change), and see if that resolves it; if not, try replacing the SQL query with fixed values.

    As an aside, I don't think having the {minval} listed as both the min and max on the interval has any effect; it just means the interval simply won't be shown (since it has zero width). The entire dial is simply spanned by the middle interval between minval and maxval, and colored red accordingly.

    -d-
    Last edited by dherzog; 03-24-2008 at 12:27 PM. Reason: added aside
    Have you hugged your computer geek today?

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.