Chartwerk Line Pod
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Eugene Petukhov f701b29bab #DOC [Readme] add browser including 2 years ago
.yarn/releases yarn migrate to 2 2 years ago
build upd core 2 years ago
examples fix live demo 2 years ago
src minor fix 2 years ago
.gitignore yarn migrate to 2 2 years ago
.yarnrc.yml yarn migrate to 2 2 years ago
LICENSE license + dep to core 3 years ago
README.md #DOC [Readme] add browser including 2 years ago
package.json 0.6.6 2 years ago
tsconfig.json sync_f17792719872f5f68b08cceb863d14ceca28c477 3 years ago
yarn.lock return latest core vesrion 2 years ago

README.md

Chartwerk Line Pod

Including

Browser

Script tag

<script src="https://unpkg.com/@chartwerk/line-pod@0.6.6/dist/index.dev.js" type="text/javascript"></script>

Example

<div id="line-chart" class="chart-block" style="width: 100%; height: 400px;"></div>

<script src="https://unpkg.com/@chartwerk/line-pod@0.6.6/dist/index.dev.js" type="text/javascript"></script>
<script>
  const pod = new LinePod(document.getElementById('line-chart'));
  
  const startTime = 1590590148;
  const arrayLength = 20;
  const k = [() => Math.floor(Math.random() * 40), () => Math.floor(Math.random() * 100), () => Math.floor(Math.random() * 20) + 90];
  const [data1, data2, data3] = [null, null, null].map((item, i) => Array.from({ length: arrayLength }, (el, idx) => [startTime + idx * 10000, k[i]()]))
  
  const options = {
    renderLegend: false,
    usePanning: false,
    axis: { y: { invert: false, range: [0, 350] }, x: { format: 'time' } },
    zoomEvents: {
      mouse: { zoom: { isActive: true, orientation: 'horizontal' } },
      scroll: { zoom: { isActive: true, orientation: 'horizontal' } }
    },
    eventsCallbacks: { zoomIn, panningEnd }
  }

  pod.updateData(
    [
      { target: 'First Dataset', datapoints: data1, color: 'green', dashArray: '5,3', class: 'first', renderArea: true },
      { target: 'Second Dataset', datapoints: data2, color: 'blue' },
      { target: 'Third  Dataset', datapoints: data3, color: 'orange' },
    ],
    options
  );

  function zoomIn(ranges) {
    options.axis.x.range = ranges[0];
    pod.updateData(undefined, options);
  }

  function panningEnd(ranges) {
    options.axis.x.range = ranges[0];
    pod.updateData(undefined, options);
  }

  pod.render();
</script>