Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    3
    Vote Rating
    0
    buzztee is on a distinguished road

      0  

    Default Answered: Change label color at runtime

    Answered: Change label color at runtime


    Hi everyone.
    I need to change the color of my line chart bottom axis at runtime.
    My chart has a right and a bottom axis. I am able to change the color of the right axis labels by setting:

    Code:
    this.lineChart.axes.items[0].labelStyle.style.fill = newColor;
    this.lineChart.redraw();
    This works fine and the color changes after calling the redraw method.
    Unfortunately I am not able to change the color of the bottom axis. If I try to change it like I did with the right axis, nothing happens.
    Code:
    this.lineChart.axes.items[1].labelStyle.style.fill = newColor;
    I got a little stuck so I'd be very pleased about any hint..

  2. Have you tried the label config on the axis?

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,582
    Vote Rating
    433
    Answers
    3102
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    Have you tried the label config on the axis?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!

    When posting code, please use BBCode's CODE tags.

  4. #3
    Sencha User
    Join Date
    Apr 2012
    Posts
    3
    Vote Rating
    0
    buzztee is on a distinguished road

      0  

    Default


    Do you mean
    Code:
    this.lineChart.axes.items[1].label.fill = 'somecolor';
    this.lineChart.redraw();
    ?
    I tried that, but it doesn't work either.

    The set color via config before rendering is being set correctly.
    Code:
    label: {
    fill: 'red'
    }

  5. #4
    Sencha User
    Join Date
    Apr 2012
    Posts
    3
    Vote Rating
    0
    buzztee is on a distinguished road

      0  

    Default


    Hi,

    I now managed to change change the label colors by setting a different config and creating a new instance of the chart.

    Thanks,
    Buzztee