Menu

How to set backgroundColor for yAxis? (needed as workaround)

Len5inG
2013-04-26
2013-04-29
  • Len5inG

    Len5inG - 2013-04-26

    Hi,
    me again.
    I have the yAxis and rotated labels anti aliasing 'bug' in my application.
    See:
    https://github.com/highslide-software/highcharts.com/issues/663

    I want to try the recommended workaround, but I am unable to set the backgroundColor.
    Simple because I don#t know how to do this correctly.

    I tried the
    .setOption("/yAxis/backgroundColor", "#ff00ff")
    .setOption("/backgroundColor", "#ff00ff")
    .setOption("/labels/backgroundColor", "#ff00ff")
    (pink to see working changes)

    but it did#t work.

    This leads to another question which I still don't understand 100%.

    Where does a .setOption() counts?

    If I have a
    chart.getYAxis.setOption("someOption", "value");

    is that like

    yAxis: {
    someOption
    }

    or 'ignores' the .setOption the current level? and counts on the chart itself.
    so is the path relative or absolute?

    hope this all is not too confusing (i am not a native english speaker),
    it would be great if someone could help me, to get this IE8-workaround working.

    using:
    GWT 2.5
    smartGWT 3.0
    Highcharts-GWT 1.5.0
    highcharts.js 2.3.5

    THX

     
  • Shawn Quinn

    Shawn Quinn - 2013-04-26

    Yes, calling "chart.getYAxis().setOption("someOption", "value")" is the equivalent of:

    yAxis: {
    someOption: "value"
    }

    However, note that, in the link you provided there it looks like they're setting the background color on the "yAxis/title" element rather than just the "yAxis" element. So, you instead probably want something like the following:

    chart.getYAxis().setAxisTitle(new AxisTitle()
        .setOption("backgroundColor", "#ffffff")
    );
    

    Related example here: http://www.moxiegroup.com/moxieapps/gwt-highcharts/showcase/#combination-multiple-axes

    Hope that helps,

    -Shawn

     
  • Shawn Quinn

    Shawn Quinn - 2013-04-26

    Related note: if you'd like to see the JSON version of the configuration options that GWT Highcharts is going to instantiate the Highcharts/Highstock instance with (so you can better compare to the Highsoft documentation), you can put a break point near the bottom of the "BaseChart.createNativeOptions()" method (around line 2146 in the current release) and take a look at the value for "options.toString()". Or, alternatively, you can un-comment the "Window.alert" statement around that same location in the "BaseChart.java" class.

     
  • Len5inG

    Len5inG - 2013-04-29

    thx alot

    chart.getYAxis()  
        .setMin(0) 
        .setAxisTitle(new AxisTitle()
            .setText(constants.dashChartAxisNameDiff())
            .setStyle(new Style()
                .setColor("#666666")
                .setOption("backgroundColor", "#ffffff")
    

    did the job.

    i will post a new thread with my (currently) last highcharts problems.

     

    Last edit: Len5inG 2013-04-29

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.