This discussion is archived
8 Replies Latest reply: Oct 24, 2013 10:59 AM by Hilary RSS

Anychart - Three y-axis question

ApexSMC Journeyer
Currently Being Moderated

I am attempting to do a line chart with 3 series and 3 y-axis.  I customized my XML using the <extra> code, and the extra axis display OK with the first 2 series mapping to the correct axis.  However the third series is mapping back to the first axis.  What I discovered was that using any name other than "extra_y_axis_1" will result in my series not being mapped to the correct axis.  Shouldn't I be able to name my extra y-axis whatever I want as long as it's a unique name?  Does this mean we can only have at most 2 y-axis in APEX, or is this a bug in my APEX version?

 

APEX version 4.2.0.00.27

Anychart version 6.0.11 (build #36916)

 

XML:

 

          </x_axis>

 

          <extra>

            <y_axis name="extra_y_axis_1" position="Opposite" enabled="true">

              <scale   mode="Normal" minimum="&P10_P_LOWER_RANGE." maximum="&P10_P_UPPER_RANGE."  />

              <minor_grid enabled="false"/>

              <major_grid enabled="false"/>

              <title>

              <text>Power(Current*Voltage)</text>

              <font family="Tahoma" size="14" color="0x000000" />

              </title>

              <labels align="Inside">

                <font color="#A4300B"/>

              <format><![CDATA[{%Value}{numDecimals:0,decimalSeparator:.,thousandsSeparator:\,}]]></format>

              </labels>

            </y_axis>

            <y_axis name="extra_y_axis_2" position="Opposite" enabled="true">

              <scale   mode="Normal" minimum="&P10_EFF_LOWER_RANGE." maximum="&P10_EFF_UPPER_RANGE."  />

              <minor_grid enabled="false"/>

              <major_grid enabled="false"/>

              <title>

              <text>Efficiency (Power/ΔWeight)</text>

              <font family="Tahoma" size="14" color="0x000000" />

              </title>

              <labels align="Inside">

                <font color="#A4300B"/>

              <format><![CDATA[{%Value}{numDecimals:0,decimalSeparator:.,thousandsSeparator:\,}]]></format>

              </labels>

            </y_axis>

          </extra>

 

        </axes>

  • 1. Re: Anychart - Three y-axis question
    LA-APEX-DEv Explorer
    Currently Being Moderated

    Check Hilary's some examples here --> https://apex.oracle.com/pls/apex/f?p=36648:117

  • 2. Re: Anychart - Three y-axis question
    Hilary Expert
    Currently Being Moderated

    Hi,

     

    The behaviour you are seeing is expected, because it sounds like you haven't customised the <data> component of the chart XML, in order to specify which series of data is to be associated with the "extra_y_axis_2" Y-Axis.  By default, when a user selects the "Multiple Y-Axis" option for their chart, a default "extra_y_axis_1" extra axis is created and is applied to the second series of data on the given chart.  Any additional series of data will automatically be associated with the 1st Y-Axis.  If you wish to create an additional Y-Axis yourself, then there are two steps to applying that extra axis to a chart:

     

    1) Specify the <extra> tags for the new axis in your chart XML - you have already completed this step.

    2) Apply the new axis to your selected data series. * you have not completed this step.

     

    You need to complete step 2 in order to achieve the behaviour you're looking for.  If you take a look at the example in my Sample Application, http://apex.oracle.com/pls/apex/f?p=36648:7, I've just revised it to include 3 Y-axes to help demonstrate the behaviour you're looking to achieve.  If you review the example, I've outlined how this can be achieved.  If you review the XML associated with the chart, you'll see that my "extra_y_axis_2" extra axis has been applied to the series data for the "Womens" category i.e.

     

    <series name="Womens" type="Bar" color="Green" y_axis="extra_y_axis_2">

     

    I hope this helps.

     

    Regards,

    Hilary

  • 3. Re: Anychart - Three y-axis question
    ApexSMC Journeyer
    Currently Being Moderated

    Thank you Hilary!  I was hoping I wouldn't have to go the custom data series route, but we've been itching to create some completely dynamic pl/sql-generated Anychart XML, so now is a good opportunity!

  • 4. Re: Anychart - Three y-axis question
    bostonmacosx Newbie
    Currently Being Moderated

    I stumbled upon this post..I don't see the custom XML on the example page for a 3 y-axis. I as well need to create a custom chart where series 1 and two will be on the primary Y axis...3 and 4 on the secondary and hopefully one more on the tertiary.

     

    thanks

    Robert

  • 5. Re: Anychart - Three y-axis question
    Hilary Expert
    Currently Being Moderated

    Hi Robert,

     

    My bad - I hadn't updated the Chart -Related Code Snippets page associated with the Multiple Y-Axes example with the revised text for the 3rd Y-axis.  It's there now, sorry about that.

     

    Regards,

    Hilary

  • 6. Re: Anychart - Three y-axis question
    bostonmacosx Newbie
    Currently Being Moderated

    thanks so much for the post and information...I have that APEX application bookmarked as the boss is requiring more advanced looks.

     

    Robert

  • 7. Re: Anychart - Three y-axis question
    bostonmacosx Newbie
    Currently Being Moderated

    I was also wondering if the XML for the setup of the charts can be dynamically created as well as the DATA part.

     

    Thanks

    Robert

  • 8. Re: Anychart - Three y-axis question
    Hilary Expert
    Currently Being Moderated

    Hi Robert,

     

    Yes, there's no reason why you couldn't generate parts or all of the setup XML yourself, if you wished to do so.  Depending on the level of modifications you're looking to make, you might want to use a similar approach to that used above (i.e. by using page item references in the "Custom XML" region, which are set to the XML you wish to add) or you might want to go down the route of generating your own stored procedure, to render the complete XML for your chart - setup and data.  If you venture down the latter route, you're really stepping outside of the dynamically created charts and might I'd recommend reviewing AnyChart's online User's Guide and XML Reference, to become more familiar with the chart attributes and associated XML that you wish to incorporate in your chart.  It's also worth searching through some older threads on the forum, where others may have posted examples of how they achieved just what you're hoping to to.

     

    Regards,

    Hilary

Legend

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