Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Numeric X-axis and Y-axis

Help
vmrao
2007-09-14
2013-01-13
  • vmrao
    vmrao
    2007-09-14

    I have successfully created few charts with cewolf. However, I could not figure out how to force x and y axis scale to numbers without decimals or ,.

    I have this code for the 'xy' chart.

    <%-- Create the result from the query --%>
    <sql:query var="xyresult" dataSource="jdbc/qualitySuggestions">
    SELECT     'By Year', YEAR(suggestion.creationDate) AS Year, COUNT(*) AS NumberOfSuggestions
    FROM         suggestion
    GROUP BY YEAR(suggestion.creationDate)
    ORDER BY YEAR(suggestion.creationDate) ASC
    </sql:query>

    <jsp:useBean id="xychart" class="de.laures.cewolf.dp.SQLDatasetProducer" />
    <c:set target="${xychart}" property="result" value="${xyresult}" />
    <c:set target="${xychart}" property="type" value="xy" />
    <c:set target="${xychart}" property="format" value="normal" />

    <cewolf:chart id="xyid" type="xy" title="No. of Suggestions By Year" xaxislabel="Year" yaxislabel="No. of Suggestions">
        <cewolf:data>
            <cewolf:producer id="xychart">
                <cewolf:param  name="maxVal" value="<%= new Integer(params.getMaxVal()) %>"/>
                <cewolf:param  name="minVal" value="<%= new Integer(params.getMinVal())  %>"/>
            </cewolf:producer>
        </cewolf:data>
        <cewolf:chartpostprocessor id="myEnhancer">
            <cewolf:param name="title" value="<%= params.getExtraTitle() %>"/>
        </cewolf:chartpostprocessor>
    </cewolf:chart>

    I would like the scale to be 1, 2, 3 ...etc instead of 2.5, 5, 7.5 (Y-axis)
    and 2007, 2006, 2005 .. etc instead of 2,007, 2,006, 2,005 etc., (X-axis - Would like to show Year)

    How can I do this ?

    Also, For the "VerticalXYBar" chart, I get the X-axis as '19:00:02.005'. I dont know what is this value. I wanted to show 'Year' just like I mentioned above. Here is the code I have for "VerticalXYBar" chart.

    <%-- Create the result from the query --%>
    <sql:query var="Verticalxybarresult" dataSource="jdbc/qualitySuggestions">
    SELECT     'By Year', YEAR(suggestion.creationDate) AS Year, COUNT(*) AS NumberOfSuggestions
    FROM         suggestion
    GROUP BY YEAR(suggestion.creationDate)
    ORDER BY YEAR(suggestion.creationDate) ASC
    </sql:query>

    <%-- Create the SQLDatasetProducer --%>
    <jsp:useBean id="Verticalxybarchart" class="de.laures.cewolf.dp.SQLDatasetProducer" />
    <c:set target="${Verticalxybarchart}" property="result" value="${Verticalxybarresult}" />
    <c:set target="${Verticalxybarchart}" property="type" value="xy" />
    <c:set target="${Verticalxybarchart}" property="format" value="normal" />

    <%-- Create the chart --%>
    <cewolf:chart id="Verticalxybarchartid" type="verticalXYBar" title="No. of Suggestions By Year" yaxislabel="No. of Suggestions" showlegend="false">
        <cewolf:data>
          <%-- Specify the SQLDatasetProducer as the data source for the chart --%>
            <cewolf:producer id="Verticalxybarchart" />
        </cewolf:data>
    </cewolf:chart>

    Please help.

    Thanks.