Browse Source

Merge branch 'render-gauge-pod' into 'main'

Render Gauge pod

See merge request chartwerk/grafana-chartwerk-panel!1
merge-requests/2/merge
Alexander Velikiy 3 years ago
parent
commit
8fbcc9c00d
  1. 18006
      package-lock.json
  2. 1
      package.json
  3. 33
      src/components/Panel.tsx
  4. 12707
      yarn.lock

18006
package-lock.json generated

File diff suppressed because it is too large Load Diff

1
package.json

@ -13,6 +13,7 @@
"author": "CorpGlory",
"license": "GPL V3",
"devDependencies": {
"@chartwerk/gauge-pod": "gitlab:chartwerk/gauge-pod#9982c0b7ca149dba807bf3b3fa1daddaf114f1a1",
"@grafana/data": "latest",
"@grafana/toolkit": "latest",
"@grafana/ui": "latest",

33
src/components/Panel.tsx

@ -1,12 +1,33 @@
import React from 'react';
import { PanelProps } from '@grafana/data';
import { PanelOptions } from '../types';
import { ChartwerkGaugePod } from '@chartwerk/gauge-pod';
import { PanelProps } from '@grafana/data';
import React, { useRef } from 'react';
import { css } from 'emotion';
interface Props extends PanelProps<PanelOptions> {}
export function Panel({ options, data, width, height, timeZone, timeRange, onChangeTimeRange }: Props) {
return (
// TODO: implement chartwerk panel
<div>Chartwerk panel</div>
);
let chartContainer = useRef(null);
// we request animation frame here because at the moment we need an existing DOM-element at the moment we render the pod
window.requestAnimationFrame(() => {
// TODO: pass datapoints
// TODO: pass options
// TODO: switch / case pod type
const pod = new ChartwerkGaugePod((chartContainer as any).current, [{ target: 'test', datapoints: [[5, 5], [0, 10], [30, 15], [50, 20], [17, 25]] }]);
pod.render();
});
return <div
ref={chartContainer}
className={
css`
width: ${width}px;
height: ${height}px;
`
}
></div>;
}

12707
yarn.lock

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save