• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript d3.selectAll函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中d3.selectAll函数的典型用法代码示例。如果您正苦于以下问题:TypeScript selectAll函数的具体用法?TypeScript selectAll怎么用?TypeScript selectAll使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了selectAll函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: sample1

export function sample1() {

  var g = d3.selectAll('.sample1');
  let svg = g.append("svg")
    .attr("width", 500)
    .attr("height", 500)
    .attr('class', 'fr__sample__svg');

  // svg render
  svg
    .append("circle")
    .attr("cx", 25)
    .attr("cy", 25)
    .attr("r", 25)
    .style("fill", "purple")
    .attr('class', 'fr__sample-circle');

  svg
    .append("text")
    .attr('x', 5)
    .attr('y', 32)
    .attr('font-size', 20)
    .attr('fill', 'red')
    .text('FOO')
    .attr('class', 'fr__sample-text');
}
开发者ID:MSakamaki,项目名称:rxjs-handson,代码行数:26,代码来源:sample.ts


示例2: drawCharts

export function drawCharts (data: any[]) {
	const charts: draw.TimeSeriesChart[] = []
	let newZoom: any = null
	const minX = new Date()
	let j = 0

	function onZoom() {
		const z = d3.event.transform.toString()
		if (z == newZoom) return

		newZoom = z
		charts.forEach(c => c.zoom(d3.event.transform))
	}

	d3.selectAll('svg').select(function() {
		const chart = new draw.TimeSeriesChart(d3.select(this), minX, 86400000, data, buildSegmentTreeTuple, onZoom)
		charts.push(chart)
	})

	setInterval(() => {
		const newData = data[j % data.length]
		charts.forEach(c => c.updateChartWithNewData([newData == undefined ? undefined : newData.NY, newData == undefined ? undefined : newData.SF]))
		j++
	}, 1000)
}
开发者ID:streamcode9,项目名称:svg-time-series,代码行数:25,代码来源:common.ts


示例3: unhighlightFocusChartAnnotation

export function unhighlightFocusChartAnnotation() {
  const annotations = d3.selectAll('.mlAnnotation');

  annotations.each(function() {
    // @ts-ignore
    const element = d3.select(this);

    element.selectAll('.mlAnnotationTextRect').classed('mlAnnotationTextRect-isBlur', false);
    element
      .selectAll('.mlAnnotationRect')
      .classed('mlAnnotationRect-isHighlight', false)
      .classed('mlAnnotationRect-isBlur', false);
    element.selectAll('.mlAnnotationText').classed('mlAnnotationText-isBlur', false);
  });
}
开发者ID:gingerwizard,项目名称:kibana,代码行数:15,代码来源:timeseries_chart_annotations.ts


示例4: highlightFocusChartAnnotation

export function highlightFocusChartAnnotation(annotation: Annotation) {
  const annotations = d3.selectAll('.mlAnnotation');

  annotations.each(function(d) {
    // @ts-ignore
    const element = d3.select(this);

    if (d._id === annotation._id) {
      element.selectAll('.mlAnnotationRect').classed('mlAnnotationRect-isHighlight', true);
    } else {
      element.selectAll('.mlAnnotationTextRect').classed('mlAnnotationTextRect-isBlur', true);
      element.selectAll('.mlAnnotationText').classed('mlAnnotationText-isBlur', true);
      element.selectAll('.mlAnnotationRect').classed('mlAnnotationRect-isBlur', true);
    }
  });
}
开发者ID:gingerwizard,项目名称:kibana,代码行数:16,代码来源:timeseries_chart_annotations.ts


示例5: it

			it('should decrease the objective weight by exactly one percent', () => {
				resizeWeightsInteraction.lastRendererUpdate = u;

				let objective = u.valueChart.getAllPrimitiveObjectives()[0];
				let aaron = u.valueChart.getUsers()[0];
				let previousWeight = aaron.getWeightMap().getNormalizedObjectiveWeight(objective.getId());

				let labelDatum: LabelData = { objective: objective, weight: previousWeight, depth: null, depthOfChildren: 0, subLabelData: null }

				let selection = d3.selectAll('rect').data([labelDatum]).enter().append('rect');

				let event: any = {} 
				event.target = selection.node();
				event.pumpType = PumpType.Decrease;

				resizeWeightsInteraction['onPump'](event);

				expect(aaron.getWeightMap().getNormalizedObjectiveWeight(objective.getId())).to.equal(previousWeight - 0.01);
			});
开发者ID:ValueChart,项目名称:WebValueCharts,代码行数:19,代码来源:ResizeWeights.test.ts


示例6: d3selectAll

	function d3selectAll(selector) { 
		return d3.selectAll(selector); 
	}
开发者ID:delosh653,项目名称:SemNExT-Visualizations,代码行数:3,代码来源:campfire-wall.ts


示例7: addArrowHead

 static addArrowHead(svgClassName: string) {
     let svg = d3.selectAll("svg." + svgClassName);
     d3.text("built/viewThreadTreeElements/threadView/arrow.html", d => {
         svg.insert('defs', ":first-child").html(d)
     });                    
 }
开发者ID:cainem,项目名称:DataViewers,代码行数:6,代码来源:svgAssets.ts


示例8: updateGraphVisibility

  // call to propagate changes to graph
  updateGraphVisibility() {
    const view = this;
    const graph = this.graph;
    const state = this.state;
    if (!graph) return;

    const filteredEdges = [...graph.filteredEdges(function (e) {
      return e.source.visible && e.target.visible;
    })];
    const selEdges = view.visibleEdges.selectAll<SVGPathElement, Edge>("path").data(filteredEdges, edgeToStr);

    // remove old links
    selEdges.exit().remove();

    // add new paths
    const newEdges = selEdges.enter()
      .append('path');

    newEdges.style('marker-end', 'url(#end-arrow)')
      .attr("id", function (edge) { return "e," + edge.stringID(); })
      .on("click", function (edge) {
        d3.event.stopPropagation();
        if (!d3.event.shiftKey) {
          view.selectionHandler.clear();
        }
        view.selectionHandler.select([edge.source, edge.target], true);
      })
      .attr("adjacentToHover", "false")
      .classed('value', function (e) {
        return e.type == 'value' || e.type == 'context';
      }).classed('control', function (e) {
        return e.type == 'control';
      }).classed('effect', function (e) {
        return e.type == 'effect';
      }).classed('frame-state', function (e) {
        return e.type == 'frame-state';
      }).attr('stroke-dasharray', function (e) {
        if (e.type == 'frame-state') return "10,10";
        return (e.type == 'effect') ? "5,5" : "";
      });

    const newAndOldEdges = newEdges.merge(selEdges);

    newAndOldEdges.classed('hidden', e => !e.isVisible());

    // select existing nodes
    const filteredNodes = [...graph.nodes(n => n.visible)];
    const allNodes = view.visibleNodes.selectAll<SVGGElement, GNode>("g");
    const selNodes = allNodes.data(filteredNodes, nodeToStr);

    // remove old nodes
    selNodes.exit().remove();

    // add new nodes
    const newGs = selNodes.enter()
      .append("g");

    newGs.classed("turbonode", function (n) { return true; })
      .classed("control", function (n) { return n.isControl(); })
      .classed("live", function (n) { return n.isLive(); })
      .classed("dead", function (n) { return !n.isLive(); })
      .classed("javascript", function (n) { return n.isJavaScript(); })
      .classed("input", function (n) { return n.isInput(); })
      .classed("simplified", function (n) { return n.isSimplified(); })
      .classed("machine", function (n) { return n.isMachine(); })
      .on('mouseenter', function (node) {
        const visibleEdges = view.visibleEdges.selectAll<SVGPathElement, Edge>('path');
        const adjInputEdges = visibleEdges.filter(e => e.target === node);
        const adjOutputEdges = visibleEdges.filter(e => e.source === node);
        adjInputEdges.attr('relToHover', "input");
        adjOutputEdges.attr('relToHover', "output");
        const adjInputNodes = adjInputEdges.data().map(e => e.source);
        const visibleNodes = view.visibleNodes.selectAll<SVGGElement, GNode>("g");
        visibleNodes.data<GNode>(adjInputNodes, nodeToStr).attr('relToHover', "input");
        const adjOutputNodes = adjOutputEdges.data().map(e => e.target);
        visibleNodes.data<GNode>(adjOutputNodes, nodeToStr).attr('relToHover', "output");
        view.updateGraphVisibility();
      })
      .on('mouseleave', function (node) {
        const visibleEdges = view.visibleEdges.selectAll<SVGPathElement, Edge>('path');
        const adjEdges = visibleEdges.filter(e => e.target === node || e.source === node);
        adjEdges.attr('relToHover', "none");
        const adjNodes = adjEdges.data().map(e => e.target).concat(adjEdges.data().map(e => e.source));
        const visibleNodes = view.visibleNodes.selectAll<SVGPathElement, GNode>("g");
        visibleNodes.data(adjNodes, nodeToStr).attr('relToHover', "none");
        view.updateGraphVisibility();
      })
      .on("click", d => {
        if (!d3.event.shiftKey) view.selectionHandler.clear();
        view.selectionHandler.select([d], undefined);
        d3.event.stopPropagation();
      })
      .call(view.drag);

    newGs.append("rect")
      .attr("rx", 10)
      .attr("ry", 10)
      .attr('width', function (d) {
        return d.getTotalNodeWidth();
//.........这里部分代码省略.........
开发者ID:dnalborczyk,项目名称:node,代码行数:101,代码来源:graph-view.ts


示例9: function

			resize.eval = function() {
				d3.selectAll('svg').remove()
				d3.select('.charts').selectAll('div').append('svg')
				common.drawCharts(data)
			}
开发者ID:streamcode9,项目名称:svg-time-series,代码行数:5,代码来源:index.ts


示例10: it

			it('should call initialize(u: RendererUpdate) to initialize the interaction', () => {
				sortAlternativesInteraction.toggleAlternativeSorting(SortAlternativesType.None, d3.selectAll('.null'), u);

				expect(sortAlternativesInteraction.lastRendererUpdate).to.deep.equal(u);
				expect(sortAlternativesInteraction['originalAlternativeOrder']).to.deep.equal(new AlternativesRecord(u.valueChart.getAlternatives()));
			});
开发者ID:ValueChart,项目名称:WebValueCharts,代码行数:6,代码来源:SortAlternatives.test.ts



注:本文中的d3.selectAll函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript d3.set函数代码示例发布时间:2022-05-24
下一篇:
TypeScript d3.select函数代码示例发布时间:2022-05-24
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap