小编Jon*_*son的帖子

d3v4 + Typescript + angular2错误使用d3.line().x((d)=> {function})

所以我有这个......

import { D3Service, D3, Selection } from 'd3-ng2-service';

interface ChartData {
    q: number,
    p: number
} 

export class GraphComponent implements OnInit{
   private d3;
   private x1;
   private y;

    constructor(element: ElementRef, d3Service: D3Service) { 
        this.d3 = d3Service.getD3(); 
        let d3 = this.d3;


    this.y = d3.scaleLinear()
    .domain([0,100])
    .range([330, 20])
    ;
    this.x1 = d3.scaleLinear()
    .range([0, 100])
    ;
}

   render() {
      let y = this.y;
      let x1 = this.x1;
      let data = [{p:1,q:1}, {p:0.5,q:2}]

       var line = d3.line()
          .x((d: ChartData) => {return x1(d.q);})
          .y((d: ChartData) …
Run Code Online (Sandbox Code Playgroud)

d3.js typescript angular

3
推荐指数
1
解决办法
3023
查看次数

ui-router sref to childchild with child in child

当我在子状态的URL中有参数时,如何创建一个将我带到孙子状态的sref?

这是一些伪代码:

.state( 'foo', {url:'/', template:'<div ui-view></div><a ui-sref="foo.bar.baz(bar: 'bing')">Bing Baz</a>'})
.state( 'foo.bar', {url:':bar',abstract: true, templateURL:'bar.tpl.html'})
.state( 'foo.bar.baz', {url:'/baz', template:'I am a baz, and if you clicked from the foo state, I should be a Bing Baz!'});
Run Code Online (Sandbox Code Playgroud)

angularjs angular-ui-router

2
推荐指数
1
解决办法
1571
查看次数