Giter Club home page Giter Club logo

Comments (5)

susielu avatar susielu commented on May 27, 2024

I just tried some examples and didn't see any issues with it being used with v5, are you running into a specific issue? I can update the docs to say that it also works with v5 otherwise.

from d3-annotation.

braco avatar braco commented on May 27, 2024

No, I can't get this library to monkey patch d3 as it seems is intended, none of the methods show up. Thought that was maybe a d3 mismatch.

I'm trying various combinations of

import * as d3 from 'd3';
import * as d3Annotation from 'd3-svg-annotation';

but something about the bundling process isn't working. Why was that method chosen out of curiosity, is that idiomatic to d3?

from d3-annotation.

gcherem avatar gcherem commented on May 27, 2024

I have the same problem. Unable to use this lib with Angular. Any update on it?

from d3-annotation.

oluckyman avatar oluckyman commented on May 27, 2024
    "d3": "^5.15.0",
    "d3-svg-annotation": "^2.3.1",

works for me with these versions ¯\(ツ)

from d3-annotation.

Ponchia avatar Ponchia commented on May 27, 2024

I'm not able to extend d3 into using the annotation library.
Having the types for d3 just throw error on d3.annotation() does not exists, while removing the type obviously throw the same error in runtime

After having installed the npm packages, I can use d3 with this import * as d3 from 'd3';, but I'm not able to extend it into using d3-svg-annotation

Haw have you done it? Sorry for the silly question

Edit:
Got it working, it was indeed a silly question.

Imported as:
import * as d3Annotation from 'd3-svg-annotation'

Using as:

let makeAnnotation: any = d3Annotation.annotation().annotations(labels).type(d3Annotation.annotationCalloutCircle).accessors({
      x: function x(d: any) {
        return _x(moment.utc(d.date, "YYYY-MM-DDTHH:mm:ss.SSSZ").toDate());
      },
      y: function y(d: any) {
        return _y(d.close);
      }
    }).accessorsInverse({
      date: function date(d) {
        return timeFormat(_x.invert(d.x));
      },
      close: function close(d) {
        return _y.invert(d.y);
      }
      // @ts-ignore
    }).on('subjectover', function (annotation) {
      ...
    }).on('subjectout', function (annotation) {
      ...
    });

Do note the use of any and @ts-ignore to get rid of type errors.

from d3-annotation.

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.