Git Product home page Git Product logo

d3-voronoi-map's People

Contributors

dependabot[bot] avatar kcnarf avatar marcofugaro avatar martinezguillaume avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

d3-voronoi-map's Issues

handleOverweighted1 sometimes gets stuck in an infinite loop

I don't fully understand what this function does! But I found while processing large trees, sometimes this function loops forever.

For a test case, I logged the following mapPoints data after 10,000 iterations:

[
  {
    index: 0,
    targetedArea: 6.63625453479814,
    data: {
      index: 0,
      weight: 15,
      initialPosition: [Array],
      initialWeight: 1.253514745461871,
      originalData: [Object]
    },
    x: 605.9975186232019,
    y: 328.2152273626913,
    weight: 4318.240094720243
  },
  {
    index: 1,
    targetedArea: 0.4424169689865427,
    data: {
      index: 1,
      weight: 1,
      initialPosition: [Array],
      initialWeight: 1.253514745461871,
      originalData: [Object]
    },
    x: 607.1700362606578,
    y: 329.4272560895722,
    weight: 4320.083905965173
  },
  {
    index: 2,
    targetedArea: 0.4424169689865427,
    data: {
      index: 2,
      weight: 1,
      initialPosition: [Array],
      initialWeight: 1.253514745461871,
      originalData: [Object]
    },
    x: 607.3920808696175,
    y: 329.9778254838309,
    weight: 4320.73147549891
  }
]

It seems to be endlessly increasing the weights without stopping.

Note if I switch to handleOverweightedVariant = 0 I don't have this problem (but I'm not sure what the implications of the two algorithms are)

Deterministic Layout

Thanks for this great library @Kcnarf ! Really enjoying exploring data with this lib and the d3-voronoi-treemap. I want to be able to create a deterministic layout so if I send the same data and parameters it always creates the same layout voronoi. What is the best way to achieve this?

'default' is not exported

I want to try this code on svelte REPL, and after I write

import { voronoiMapSimulation } from 'd3-voronoi-map'

it shows warning:

'default' is not exported by https://unpkg.com/[email protected]/src/index.js, imported by https://unpkg.com/[email protected]/build/d3-weighted-voronoi.js

because I use REPL, so I didn't use npm install for dependencies

Uncaught TypeError: Cannot set property 'twin' of null

Hi, I am using this library to draw Voronoi map and meet a weird bug keep reporting:

bug

The error keeps popping out and flushed the console. And sometimes the script stops at the following breakpoint:

console.log('at least 1 site has no area, which is not supposed to arise');debugger;

I have paid lots of efforts to filter out other possible origins of the bug and please see a minimal example for the bug as follows. Please note that this bug seems to be present at random, and you may need to refresh the browser multiple times to see the complaints.

<!DOCTYPE html>
<html>

<head>
    <script src="http://d3js.org/d3.v5.min.js"></script>
    <script src="https://rawcdn.githack.com/Kcnarf/d3-weighted-voronoi/v1.0.0/build/d3-weighted-voronoi.js"></script>
    <script src="https://rawcdn.githack.com/Kcnarf/d3-voronoi-map/v2.0.0/build/d3-voronoi-map.js"></script>
    <style>
        #glyphDiv {
            height: 800px;
            width: 1000px;
            overflow: scroll;
        }
    </style>
</head>

<body>
    <div id='glyphDiv'>
    </div>
</body>

<script type="text/javascript">
  var data = [
    {size: 0.1},
    {size: 0.2},
    {size: 0.3},
    {size: 0.4},
  ]
  var simu_list = [];
  function test () {
    var simulation = d3.voronoiMapSimulation(data)
      .clip([[-6,10],[-12,0],[-62,0],[-31,54]])
      .weight(function(d) {return d.size})
    simu_list.push(simulation);
  }

  for(var i = 0; i < 100; i ++) {
    test();
  }

</script>

</html>

Could anyone help me out?

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.