Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

color saturation applied to a measure #5

Open
Raynok opened this issue Jul 13, 2017 · 1 comment
Open

color saturation applied to a measure #5

Raynok opened this issue Jul 13, 2017 · 1 comment

Comments

@Raynok
Copy link

Raynok commented Jul 13, 2017

image

I agree, would be great to show the following by colors example

  1. Over 100% red

  2. Equals 100 % green

  3. Below 100% orange or coral

@Raynok
Copy link
Author

Raynok commented Mar 4, 2018

@kiewic

Added the following, directly into the code as a workaround.


// Divide by 2, because there are 2 lines of code.
// And divide by 3 because the 15% on the top and 15% on the bottom should be margin.
var percentageTextMargin = textGHeight / 2 / 6;

        var fontSize = textGHeight / 2 - percentageTextMargin * 2;
        var percentageTextY = fontSize / 2 + percentageTextMargin;

        if (percentage < 100)
        {
            console.log("Percentage under 100 :" + percentage);
            this.percentageText.style({
                'fill': 'green',
                'font-size': fontSize + 'px',
                'font-family': options.fontFamily,
            }).text(
                percentageString)
                .attr({
                    'y': percentageTextY + 'px',
                    'x': options.width / 2,
                });
        }
        if ((percentage+100) > 100) {
            console.log("Percentage over 100 :" + percentage);
                this.percentageText.style({
                    'fill': 'red',
                    'font-size': fontSize + 'px',
                    'font-family': options.fontFamily
                }).text(
                    percentageString)
                    .attr({
                        'y': percentageTextY + 'px',
                        'x': options.width / 2,
                    });
            }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants