How to use d3-flame-graph - 5 common examples

To help you get started, we’ve selected a few d3-flame-graph examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rangle / augury-labs / packages / performance-profiler-ui / src / index.ts View on Github external
if (!moduleColors[moduleName]) {
      moduleColors[moduleName] = getFakeRandomColor()
    }
    return moduleColors[moduleName]
  }

  const totalruntime = flameGraph.reduce((totalTime, spike) => totalTime + spike.value, 0)

  d3.select(innerFlame)
    .datum({
      name: '--task--',
      value: totalruntime,
      children: flameGraph,
    })
    .call(
      flamegraph()
        .width(window.innerWidth * 0.9)
        .cellHeight(18)
        .transitionDuration(750)
        .transitionEase(d3.easeCubic)
        .color(node => getModuleColor(node.data.moduleName)),
    )

  lastInnerFlame = innerFlame
}
github jantimon / cpuprofile-webpack-plugin / packages / cpuprofile-viewer / src / components / FlameGraph.tsx View on Github external
renderChart() {
    const wrapper = this.wrapperRef.current;
    if (!wrapper) {
      return;
    }
    const flameGraph = flamegraph()
      .width(1600)
      .cellHeight(18)
      .transitionDuration(250)
      .minFrameSize(0.1)
      .inverted(true)
      .transitionEase(easeCubic)
      .sort(false)
      .onClick(this.onClickHandler.bind(this))
      .differential(false)
      .elided(false)
      .selfValue(false)
      .setColorMapper(this.colorMapper.bind(this))
      .label(this.labelMapper.bind(this));
    const chart = document.createElement("div");
    select(chart)
      .datum(this.props.flameGraphNode)
github rangle / augury-labs / packages / frontend / src / app / components / flame-graph / flame-graph.component.ts View on Github external
public paint() {
    if (this.isReady) {
      this.clearExistingGraph();

      this.width = this.container.nativeElement.clientWidth;

      const t = tip()
        .direction('s')
        .offset([8, 0])
        .attr('class', 'd3-flame-graph-tip')
        .html(d => `${d.data.name}: ${round2(d.data.value)}ms`);

      const fgraph = flamegraph()
        .width(this.width)
        .tooltip(t);

      d3.select(this.container.nativeElement)
        .datum(this.rootNode)
        .call(fgraph);
    }
  }
github Netflix / flamescope / src / components / FlameGraph / FlameGraph.jsx View on Github external
drawFlamegraph() {
        const { data } = this.state
        const { compare } = this.props
        const width = document.getElementById('flamegraph').offsetWidth

        const cellHeight = 16
        const chart = flamegraph()
            .width(width)
            .cellHeight(cellHeight)
            .transitionDuration(750)
            .sort(true)
            .title('')
            .differential(compare === 'differential' ? true : false)
            .minFrameSize(5)
            .inverted(this.state.layout === layout.icicle)
            .selfValue(true)

        var details = document.getElementById("details")
        chart.details(details)

        select(`#flamegraph`)
            .datum(data)
            .call(chart)
github flamegrapher / flamegrapher / frontend / src / Flames.vue View on Github external
mounted () {
    const chart = flamegraph()
            .width(1110)
            .cellHeight(18)
            .transitionDuration(750)
            .sort(false)
            .title("");

    this.chartState = chart;
    const params = this.$route.params;
    if (params.flameJsonData !== undefined) {
      select(`#chart`)
            .datum(response.flameJsonData)
            .call(chart);
      this.loading = false;
    } else {
      const url = "/api/flames/" + params.eventType + "/" + params.pid + "/" + params.recording;
      this.$http.get(url)

d3-flame-graph

A d3.js library to produce flame graphs.

Apache-2.0
Latest version published 2 years ago

Package Health Score

53 / 100
Full package analysis

Popular d3-flame-graph functions