JavaScript d3js get <path d=“NaN”> when splitting my code in object d3js path data,d3js path d,d3js path drag,d3js

I'm trying to draw a map with d3.js. I already did it a first time and it worked, but now I try to split my code to make it easier to read. When i split it i get NaN instead of position in my path.

Here is a link to my repo if you want the full version: https://github.com/TheWalkingDesign/map-plugin

Thank for the help, I'm stuck with this.

this.projection = setProjection(
        this.options.projection,
        this.options.center,
        this.options.translate,
        this.options.scale
        );

    this.path = d3.geo.path().projection(this.projection);

    this.svg = d3.select("#"+this.options.mapid).append("svg")
        .attr("width", this.width)
        .attr("height", this.height)
        .call(this.zoom); // enable zoomable on svg

    this.g = this.svg.append("g");

    drawMap(this.topo, this.path, this.g, this.options.mapid);

function setProjection(type, center, translate, scale) {
    var projection;
    if (type === 'equirectangular') {
        projection = d3.geo.equirectangular();
    } else if (type === 'mercator') {
        projection : d3.geo.mercator();
    }
    projection.center(center) // bug when set to 0, 0
        .translate(translate) // center the map in the container
        .scale(scale); // scale the map to fit the width of container
    return projection;
};

function drawMap(topo, path, container, mapid) {
    // Draw countries geometry on map
    var countries = container.append('g').attr('id', mapid + '_countries').selectAll('.' + mapid + '_country').data(topo);

    countries.enter().append("path")
        .attr("class", mapid + '_country')
        .attr("d", path);

};
Answer:1

You are executing path inside the scope of drawMap that's why it can't find this.projection.

Try this:

this.path = d3.geo.path().projection(this.projection).bind(this);
Answer:2

I'm having problem with using Kendo UI Grid whenever I click on add new button it always produce this script error. This is the code that I'm using: dataSource = new kendo.data.DataSource({ ...

I'm having problem with using Kendo UI Grid whenever I click on add new button it always produce this script error. This is the code that I'm using: dataSource = new kendo.data.DataSource({ ...

  1. uncaught typeerror e is not a function
  2. uncaught typeerror e b is not a function
  3. uncaught typeerror e is not a function bootstrap
  4. uncaught typeerror e h is not a function
  5. uncaught typeerror e o is not a function
  6. uncaught typeerror e.indexof is not a function
  7. uncaught typeerror e.indexof is not a function at w.fn.init.w.fn.load
  8. uncaught typeerror e.preventdefault is not a function
  9. uncaught typeerror e.indexof is not a function at k.fn.init.k.fn.load
  10. uncaught typeerror e.replace is not a function
  11. uncaught typeerror e is not a constructor
  12. uncaught typeerror e.indexof is not a function jquery
  13. uncaught typeerror e.push is not a function
  14. uncaught typeerror e.size is not a function
  15. uncaught typeerror e.indexof is not a function jquery 3.3.1
  16. uncaught typeerror e.stoppropagation is not a function
  17. uncaught typeerror e.indexof is not a function wordpress
  18. uncaught typeerror e.fancybox.getinstance is not a function
  19. uncaught typeerror e.split is not a function
  20. uncaught typeerror e.target.classname.indexof is not a function

I have an HTML form, that takes the 'student Id', 'Notes' from the professor. On clicking 'Submit', it takes those values and stores it in the student_information table and displays all the content of ...

I have an HTML form, that takes the 'student Id', 'Notes' from the professor. On clicking 'Submit', it takes those values and stores it in the student_information table and displays all the content of ...

  1. content table javascript
  2. change table content javascript
  3. get table content javascript
  4. clear table content javascript
  5. update table content javascript
  6. refresh table content javascript
  7. delete table content javascript
  8. read table content javascript
  9. copy table content javascript
  10. print table content javascript
  11. get table cell content javascript
  12. change table cell content javascript
  13. javascript table content change event
  14. update table content using javascript
  15. pdf table of content javascript

I would like to send Ajax request in pug template file. form#payment-form() section label(for="amount") input#amount(name="amount" type="tel" min="1" placeholder="Amount" ...

I would like to send Ajax request in pug template file. form#payment-form() section label(for="amount") input#amount(name="amount" type="tel" min="1" placeholder="Amount" ...

  1. send ajax request javascript
  2. send ajax request jquery
  3. send ajax request onbeforeunload
  4. send ajax request from chrome console
  5. send ajax request every 5 seconds
  6. send ajax request in laravel
  7. send ajax request online
  8. send ajax request on button click
  9. send ajax request on page load
  10. send ajax request js
  11. send ajax request python
  12. send ajax request to same page
  13. send ajax request php
  14. send ajax request to server
  15. send ajax request react
  16. send ajax request to servlet
  17. send ajax request postman
  18. send ajax request jquery php
  19. send ajax request on select change
  20. send ajax request using jquery

I installed gulp and everything seems fine except for this error when running the gulp command. I get Error: You need to have Ruby and Compass installed and in your system PATH for this task to work. ...

I installed gulp and everything seems fine except for this error when running the gulp command. I get Error: You need to have Ruby and Compass installed and in your system PATH for this task to work. ...

  1. gulp cannot find module
  2. gulp cannot get /
  3. gulp canine
  4. gulp cannot find module 'browser-sync'
  5. gulp cannot find module '@babel/core'
  6. gulp cannot find module 'gulp-sass'
  7. gulp cannot find module 'del'
  8. guelph canada
  9. gulp cannot find module 'internal/util/types'
  10. gulp cannot find module '@microsoft/sp-build-web'
  11. gulp cannot find module 'jshint/src/cli'
  12. gulp cannot find module 'orchestrator'
  13. gulp cannot find module 'babel-preset-es2015'
  14. gulp cancel task
  15. gulp cannot find module 'laravel-elixir'