Announcement

Collapse
No announcement yet.

Rendering in bar charts

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Rendering in bar charts


    I have a bar chart that I am showing 2 fields per row. One This year and one last year. I want to change the color of the bar for the field last year ? How do I do that ? I see there is custom formatting but I am not sure how it works ? Any help would be appreciated.

    See attachment.

    Attached Files

  • #2
    This is possible within the "Custom Formatting" section.

    Code:
    var store = rendererData.store,
        rec   = store.getAt(index),
        field = sprite.getField();
    
    if (field === 'MY_FIELD'){
        return setColor('#F44336');    // OR ANY COLOR YOU LIKE
    } else {
       return setColor('SOME_OTHER_COLOR');
    }

    Comment


    • #3
      I have 2 fields also specified as Legend but the colors for both are the same. How do I get them to match the same color as the bar ?

      Comment


      • #4
        In that case I would recommend simply selecting 2 colors from the "UI" section. This way it will honor those same colors in the legend.

        Comment


        • #5
          Forgot to mention, you would then have to remove the code in "Custom Formatting".

          Comment

          Working...
          X