{% extends "e2e/templates/_base.tpl.html" %} {% block name %}Playground{% endblock %} {% block headStart %} {% endblock %} {% block ngModules %}['xeditable', 'n3-line-chart']{% endblock %} {% block data %}generateData(15){% endblock %} {% block options %} { axes: { x: { key: "x" }, y: { tooltipFormat: ".2f" } }, margin: { left: 0, right: 0, bottom: 0, top: 0 }, series: [ { dataset: "dataset0", key: "y0", id: "series1", label: "A line", color: "steelblue" }, { dataset: "dataset0", key: "y1", id: "series2", label: "A column", color: "orange", type: "column" }, { dataset: "dataset0", key: "y0", id: "series3", label: "An area", color: "salmon", type: "area" } ] } {% endblock %} {% block ngController %} $scope.params = getParams(); $scope.addDatapoint = addDatapoint; $scope.removeDatapoint = removeDatapoint; function getParams(){ return { lineMode: [ 'linear', 'step-before', 'step-after', 'basis', 'basis-open', 'basis-closed', 'bundle', 'cardinal', 'cardinal-open', 'cadinal-closed', 'monotone' ], series:{ axis: [ 'y', 'y2' ], type: [ 'line', 'area', 'column' ] }, axis: { type: [ 'linear', 'date', 'log' ] } }; } function generateData(numPoints){ numPoints = numPoints || 10; return { 'dataset0': d3.range(numPoints).map(function(d){ return { x: d, y0: rand(0, 10), y1: rand(0, 100), y2: rand(0, 50) } }), 'dataset1': d3.range(numPoints).map(function(d){ return { x: d, y0: rand(0, 10), y1: rand(0, 100), y2: rand(0, 50) } }) }; } function addDatapoint(dataset){ $scope.example.data[dataset].push({ x: $scope.example.data[dataset][$scope.example.data[dataset].length - 1].x + 1, y0: rand(0, 10), y1: rand(0, 100), y2: rand(0, 50) }); } function removeDatapoint(dataset, point){ $scope.example.data[dataset].splice( $scope.example.data[dataset].indexOf(point), 1 ); } function rand(min, max){ min = min || 0; max = max || 1; return min + (max - min) * Math.random(); } {% endblock %} {% block bodyCenter %}

Data

{$ dataset $}

x y0 y1 y2
{$ d.x $} {$ d.y0 | number:2 $} {$ d.y1 | number:2 $} {$ d.y2 | number:2 $}

Data

{$ example.data | json $}

Options

{$ example.options | json $}
{% endblock %} {% block bodyEnd %} {% endblock %}