Git Product home page Git Product logo

Comments (2)

alexcjohnson avatar alexcjohnson commented on May 18, 2024

Thanks @baptistelabat-syroco!

Looks like the SVG engine treats the start and end points as identical in this case, so it can't figure out how to draw the nearly-360-degree arc. We already catch this when the arc is exactly 360 degrees:

if(pt.v === cd0.vTotal) { // 100% fails bcs arc start and end are identical
var outerCircle = 'M' + (cx + pt.px0[0]) + ',' + (cy + pt.px0[1]) +
arc(pt.px0, pt.pxmid, true, 1) +
arc(pt.pxmid, pt.px0, true, 1) + 'Z';
if(hole) {
slicePath.attr('d',
'M' + (cx + hole * pt.px0[0]) + ',' + (cy + hole * pt.px0[1]) +
arc(pt.px0, pt.pxmid, false, hole) +
arc(pt.pxmid, pt.px0, false, hole) +
'Z' + outerCircle);
} else slicePath.attr('d', outerCircle);

Seems like we just need to loosen this criterion. Might as well do this for any slice bigger than 50%. Should be as simple as changing pt.v === cd0.vTotal to pt.v > cd0.vTotal / 2 and changing a couple of those pt.px0 to pt.px1 (probably the last one in the main arc and the first in the hole)... then adding the condition you found to a test image. Feel like making a PR???

from plotly.js.

baptistelabat-syroco avatar baptistelabat-syroco commented on May 18, 2024

Hi alexcjohnson, I am coding more in python than javascript, so not sure how to handle and test this.

We have a workaround in python, but better to correct it at root.
values=np.round(np.array(values) / max(values), 6)*max(values)

I'll let you know if I can find more time to invest or find support for this.

from plotly.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.