MCPcopy
hub / github.com/palantir/plottable / run

Function run

quicktests/overlaying/tests/basic/canvas_grid.js:13–42  ·  view source on GitHub ↗
(div, data, Plottable)

Source from the content-addressed store, hash-verified

11}
12
13function run(div, data, Plottable) {
14 "use strict";
15 var xScale = new Plottable.Scales.Category();
16 var yScale = new Plottable.Scales.Category();
17 var xAxis = new Plottable.Axes.Category(xScale, "bottom");
18 var yAxis = new Plottable.Axes.Category(yScale, "left");
19
20 var colorScale = new Plottable.Scales.InterpolatedColor();
21
22 var plot = new Plottable.Plots.Rectangle().addDataset(new Plottable.Dataset(data))
23 .renderer("canvas")
24 .x((d) => d.x, xScale)
25 .y((d) => d.y, yScale)
26 .attr("fill", (d) => d.val, colorScale);
27
28 var table = new Plottable.Components.Table([
29 [yAxis, plot],
30 [null, xAxis]
31 ]);
32
33 new Plottable.Interactions.PanZoom(xScale, yScale)
34 .attachTo(plot)
35 .setMinMaxDomainValuesTo(xScale)
36 .setMinMaxDomainValuesTo(yScale);
37
38 table.renderTo(div);
39 window.addEventListener("resize", () => {
40 table.redraw();
41 });
42}

Callers

nothing calls this directly

Calls 9

attrMethod · 0.80
rendererMethod · 0.80
renderToMethod · 0.80
redrawMethod · 0.80
yMethod · 0.45
xMethod · 0.45
addDatasetMethod · 0.45
attachToMethod · 0.45

Tested by

no test coverage detected