nteract / semiotic

A data visualization framework combining React & D3
https://semioticv1.nteract.io/
Other
2.43k stars 133 forks source link

Documentation does not show an example of how to highlight area on graph #494

Closed pashpashpash closed 5 years ago

pashpashpash commented 5 years ago

I implemented my highlight annotations in a similar way to the annotations documentation:

const annotation = {
                    type: "bounds",
                    bounds: [ {timestamp: timestamp1}, {timestamp: timestamp2} ],
                    label: "Advertisement",
                    dx: 150,
                    dy: -40,
                    color: "blue",
};

However, the result differs from the docs' example: image

I'd like to understand how to specify that I want to fill the area with a color, not just outline it with the color attribute. Would be nice to see this in the documentation as well.

pashpashpash commented 5 years ago

Update: I was able to get highlighting to work by adding a css Classname. Originally adding the classname did not work because of scss local scoping, but surrounding my css rules in a :global() tag did the trick:

:global(.advertisement .subject){
    fill: #ffdb4d;
    stroke: #ffdb4d;
    fill-opacity:0.1;
}

:global(.stalled .subject){
    fill:red;
    stroke:red;
    fill-opacity:0.1;
}