tomwanzek / d3-ng2-service

A D3 service for use with Angular.
MIT License
205 stars 42 forks source link

No Explanation as WHY we need a D3 service #131

Open nhhockeyplayer opened 4 years ago

nhhockeyplayer commented 4 years ago

Great work friend I admire your effort and demos on angular component breaking ground

I have been using D3 commercially as follows

  1. install all usable packages in package.json D3 and its typedef packages @types/d3-*** dependencies
    
        "d3": "5.16.0",
        "d3-array": "^2.3.3",
        "d3-brush": "^1.1.3",
        "d3-color": "^1.4.0",
        "d3-force": "2.0.1",
        "d3-format": "1.4.4",
        "d3-hierarchy": "^1.1.9",
        "d3-interpolate": "^1.4.0",
        "d3-scale": "^3.2.0",
        "d3-selection": "^1.4.1",
        "d3-shape": "^1.3.7",
        "d3-time-format": "2.2.3",

dev dependencies
    "@types/d3-array": "2.0.0",
    "@types/d3-axis": "1.0.12",
    "@types/d3-brush": "1.1.0",
    "@types/d3-color": "1.2.2",
    "@types/d3-drag": "^1.2.3",
    "@types/d3-force": "1.2.1",
    "@types/d3-format": "1.3.1",
    "@types/d3-hierarchy": "1.1.6",
    "@types/d3-interpolate": "1.3.1",
    "@types/d3-scale": "2.2.0",
    "@types/d3-selection": "1.4.1",
    "@types/d3-shape": "^1.3.2",
    "@types/d3-time": "1.0.10",
    "@types/d3-time-format": "2.1.1",
    "@types/d3-transition": "1.1.6",


and after that in my typescript I just

`import * as d3 from 'd3'`

can you explain the overhead of not only a service (injectables are great no offense) but a new private variable per component?

I just think its extra overhead when we can just import d3 and run with it

and I declare any types along the way in my code as such

advise please

generally I will model a service to get the handle to a ionic plugin say SWIFT or SWERVE or ADOBE Analytics to secure appropriate wrapped context/handle

RxJS is identical in anatomy to D3 and we use RxJS as such without any need for a service

Angular alone is inadequate due to code bloat on the component. So given potentially hundreds of components your solution is an imposition to my clean code advocacy and if one really wants to reduce code bloat on components then jump to next level using NgRX which boiler plates ALL abstractions and leaves the angular component in bare naked form of PURE business logic.

great job though I appreciate your feedback on WHY you want to impose a D3 service or if there are global space issues we are unaware of or even type definition issues.

thanks friend

- cheers

KEN
nhhockeyplayer commented 4 years ago

well after reviewing your code i give it a thumbs up for consolidation does it enforce auto import of d3-selection instead of lib.dom.d.ts Selection ?

I use the same strategy with material Design and all its components in a separate module for just bringing in everything in one module.

a 5 point bulleted WHY would help the readme is not concise quick to the point which a fast developer needs.

thanks for all your hard work

any commentary is appreciated