This discussion is archived
7 Replies Latest reply: Mar 29, 2013 7:48 AM by zooid RSS

Apex Chart with multiple y-axis

zooid Newbie
Currently Being Moderated
Hi,

I am using the build-in flash Apex chart which I understand to be a subset of the Anychart.

I have the following problem, I have two series, which I am displaying in a 3D Bar Chart on a horizontal view with two Y-Axis. This works well, the problem is that each Y -Axis has a different scale. I am not setting the min or max value range for either of the y-axis as I do not know what this value range may be at the time of rendering the chart to the application user.

So as it turns out, the left y-axis has a value range from zero to 100 and the right y-axis has a value range from zero to 50 and the application users are finding this difficult and confusing as they are only looking at the bars represented in the chart and assuming that as the two bars, i.e. one form each series look similar in size, they have the same value and this can not be further from the true, as one y-axis is showing a value range twice as big as the other y-axis.

So my question is how do you customise the chart so that the value range on both y-axis is the same. i.e., the largest of the two?

Application Express 4.0.2.00.07

Thank you
  • 1. Re: Apex Chart with multiple y-axis
    Howard (... in Training) Pro
    Currently Being Moderated
    Let me understand. Do you want/need the chart to have two different y-axes? Would it work with one common y-axis? -- Howard
  • 2. Re: Apex Chart with multiple y-axis
    zooid Newbie
    Currently Being Moderated
    Hi Howard,

    I require to show two y-axis as it currently does, but I need both y-axis to display the same value range so that the columns represented in the chart are proportional in size to each other.

    For example: if column 1 from series 1 is 100 unit tall and column 1 from series 2 is 50 unit tall, then column 2 should be half the height of column 1.

    Thank you
  • 3. Re: Apex Chart with multiple y-axis
    Howard (... in Training) Pro
    Currently Being Moderated
    Okay. [But charts are designed to be space/page-filling.  That is to increase or decrease in size, adjusting the scale so they make a nice picture.  Well, so much for that.]

    I don't know of any facility to synch the two axes. But you can set the y-min and y-max. So I guess you could query the data, pre-compute these and then force both charts to have these same values. [I think this can be done.]

    If you go this route, you'll need to decide how to compute y-min and y-max given your data. Then you can assign those values to variables which get use for the y axis. [I think I can find XML to assign the values for y-min and y-max.  I'll check tomorrow.]

    Good luck!
    Howard
  • 4. Re: Apex Chart with multiple y-axis
    Howard (... in Training) Pro
    Currently Being Moderated
    You can't get axis scale variables to work in the APEX declaritive GUI because it's not designed for that. You will have to switch to custom XML.

    Set everything you want -- that you can set -- because once you switch to XML, if you switch back I think you lose all those custom settings. Then when you set Custom to "Yes", drag the window widget to enlarge the window so you can edit more easily.
    Find the y_xis section of the XML.
            <axes>
              <y_axis >
                <scale   mode="Normal"    />
                <title>
                  <text>Directory Size (Gigabytes)</text>
                  <font family="Tahoma" size="16" color="0x000000" />
                </title>
                <labels enabled="true" position="Outside">
                  <font family="Tahoma" size="10" color="0x000000" />
                  <format><![CDATA[{%Value}{numDecimals:1,decimalSeparator:.,thousandsSeparator:\,}]]></format>
                </labels>
                <major_grid enabled="True" interlaced="false">
                    <line color="Black" />
                  </major_grid>
    <minor_grid enabled="True">
                  </minor_grid>
                
              </y_axis>
    You want to change the scale line between
    <y_axis>   </y_axis>
    to
    <scale mode="Normal"  maximum="100" minimum="0" />
    Or maybe it's just
    <scale maximum="100" minimum="0" />
    Except instead of constants, you want variables. I'm not sure you can use bind variable (:P7_YMAX, :P7_YMIN) you may have to use (#YMAX#, #YMIN#) variables.

    I would make a new page and experiment with some VERY simple data -- maybe constants in a SELECT -- SELECT ..., 1, 2, 3 from dual ...... until you get what works.

    And, again. This assumes you decide on some computation to compute the values of (:P7_YMAX, :P7_YMIN) or (#YMAX#, #YMIN#) you want it to use.

    Howard
  • 5. Re: Apex Chart with multiple y-axis
    zooid Newbie
    Currently Being Moderated
    Hi Howard,

    Thank you for you detail reply. To tell you the true, I almost always use the custom XML window as I find that the GUI within Apex does not allow sufficient control.

    I appreciate your help and was hoping for some tag to exist which will enforce some proportionality between the y-axis, or set all y-axis to have the same value range. I.e. I was looking for the easy way out :-)

    I have seen the use of the following tag, which I am not sure of its meaning or what it does?
    <scale   mode="Normal"    />
    I guess that as you mention I must compute the value range and adjust the multiple y-axis to the correct value range with bind variables.

    Once more thank you for your help.

    Edited by: zooid on Mar 29, 2013 1:22 PM
  • 6. Re: Apex Chart with multiple y-axis
    Howard (... in Training) Pro
    Currently Being Moderated
    Oh, here are the modes. See: http://www.anychart.com/products/anychart/docs/users-guide/Axes-Scales.html#mode
    >
    Scale mode - - - - - Charts
    Normal - - - - - - - - Default for all
    Stacked - - - - - - -- All ordinal types (Bar, Line, Area, etc.)
    PercentStacked - - All ordinal types (Bar, Line, Area, etc.)
    Overlay - - - - - - - Bar
    SortedOverlay - - - Bar, Bubble
    >
    Until later,
    Howard
  • 7. Re: Apex Chart with multiple y-axis
    zooid Newbie
    Currently Being Moderated
    Howard,

    Once more thank you. I had not found this area in the AnyChart site.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points