Search code examples
highchartscolorsproject-organization

Organization Chart Double Color in 1 Box


my issue is that I need to style 1 Box (Box=Task Box, background is stylebar with Color:) with 2 Colors. So for example a task is done 20%, the normal box is yellow. But 20% should be a darker yellow to indicate that the task is 20% complete. Is there any possible way to do this very smoothly. Thanks in advance Juli.w (And Im sry for my bad english, I’m German :))


Solution

  • You can define the color as a Highcharts.GradientColorObject to achieve the wanted result:

        nodes: [..., {
                ...,
                color: {
                    linearGradient: {
                        x1: 0,
                        x2: 1,
                        y1: 0,
                        y2: 0
                    },
                    stops: [
                        [0, '#fffdaa'], // start
                        [0.25, '#fffdaa'], 
                        [0.25, '#878300'], 
                        [1, '#878300'] // end
                    ]
                }
            }
        ]
    

    Live demo: https://jsfiddle.net/BlackLabel/r6qxgLtm/

    API Reference: https://api.highcharts.com/class-reference/Highcharts.GradientColorObject