Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does it work along to Angular 8 + latest d3? #160

Open
pedroccg opened this issue Jul 23, 2019 · 2 comments
Open

Does it work along to Angular 8 + latest d3? #160

pedroccg opened this issue Jul 23, 2019 · 2 comments

Comments

@pedroccg
Copy link

I can't build your source code with success.

Maybe its my angular version?

@Robouste
Copy link

Check last commit date, this project is dead

@ghost
Copy link

ghost commented Aug 22, 2019

It is currently using almost the latest version of "nvd3": "^1.8.5" which is 1.8.6 which support "d3": "~5.5.0". and the latest version of "d3" is 5.11.0 .. I belive that this plugins suports the latest angular 8 version, but since it doesn`t have @types you'll have to know all necessary properties to create your specific graph. Check nvd3 documentation to understand the properties

    var newarc = d3.svg.arc()

      .innerRadius(innerRadius - (30 * value))
      .outerRadius(outerRadius)
      .startAngle(function (d, i) {
        return radians * i
      })
      .endAngle(function (d, i) {
        return radians * (i + 1)
      });

    d3.selectAll("nvd3").attr("d", newarc);


    let mode = "count"

// The secret for this to work properly relies on OPTIONS parameter
this.options = {
      chart: {
        type: "sunburstChart",
        height: 1000,
        duration: 350,
        dispatch: {},
        sunburst: {
          dispatch: {},
          // width: 600,
          height: 1000,
          // mode: mode,
          mode: "value",
          //id: 3837,
          duration: 0,
          groupColorByParent: true,
          showLabels: true,
          labelFormat: function (d, i ,k) { //console.log("LABEL", d, i , k);
           if (mode === 'count') {  return d.name.replace(/#.*#/,"") } else { return d.name.replace(/#.*#/,"") + ' ' + (d.value || d.size) } },
          labelThreshold: 0.6,
          margin: {
            top: 0,
            right: 0,
            bottom: 0,
            left: 0
          }
        },
 tooltip: {
          duration: 0,
          gravity: "w",
          distance: 25,
          snapDistance: 0,
          classes: ["tooltipStyle"],
          chartContainer: document.querySelectorAll("#nvtooltip")[0],
          enabled: true,
          hideDelay: 150,
          headerEnabled: true,
          headerFormatter: function (d,i,k) {
            //console.log("HEADER",d,i,k);
            //return d;
          },
   fixedTop: null,
          offset: {
            left: 0,
            top: 0
          },
          hidden: false,
          data: null,
          id: "nvtooltip"
        },
        // width: 600,
        mode: "value",
        // mode: mode,
        // {type: String,value: 'value',observer: 'modeChanged'},groupColorByParent: true,showLabels: true,
        labelThreshold: 0.11,
        margin: {
          top: 30,
          right: 20,
          bottom: 20,
          left: 20
        },
        noData: null,
        defaultState: null
      },
      title: {
        enable: false,
        text: "Grafico de vendas",
        className: "h4",
        css: {
          width: "600px",
          textAlign: "center"
        }
      },
      subtitle: {
        enable: false,
        text: "Write Your Subtitle",
        css: {
          width: "600px",
          textAlign: "center"
        }
      },
      caption: {
        enable: false,
        text: "Figure 1. Write Your Caption text.",
        css: {
          width: "600px",
          textAlign: "center"
        }
      },
      styles: {
        classes: {
          "with-3d-shadow": true,
          "with-transitions": true,
          gallery: false
        },
        css: {
          "-webkit-transform": "translate3d(0, 0, 0)",
          "-moz-transform": "translateZ(0)",
          "-ms-transform": "translateZ(0)",
          "-o-transform": "translateZ(0)",
          "transform": "translateZ(0)"
        }
      }

But I've manage to put this on work using Angular 7 with lazy loading, without a problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants