X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=js%2Fsrc%2Fchart%2FChartPart.js;fp=js%2Fsrc%2Fchart%2FChartPart.js;h=1fe922116df1b4a2ec3c41a78221e08e1ae2b251;hb=f9b3af44af6897b286de0674bc9a919c689ff64e;hp=0000000000000000000000000000000000000000;hpb=711408cc603c2ebe21f8b825456bcbbe59e02f70;p=gpl%2Fargeo-suite.git diff --git a/js/src/chart/ChartPart.js b/js/src/chart/ChartPart.js new file mode 100644 index 0000000..1fe9221 --- /dev/null +++ b/js/src/chart/ChartPart.js @@ -0,0 +1,34 @@ +/** API to be used by Java. + * @module MapPart + */ + +/** Abstract base class for displaying a map. */ +export default class ChartPart { + + /** The name of the chart, will also be the name of the variable */ + #chartName; + + constructor(chartName) { + this.#chartName = chartName; + this.createChartCanvas(this.#chartName); + } + + + // + // HTML + // + /** Create the div element where the chart will be displayed. */ + createChartCanvas(id) { + const chartDiv = document.createElement('canvas'); + chartDiv.id = id; + //chartDiv.style.cssText = 'width: 100%;'; + chartDiv.style.cssText = 'width: 100%; height: 100vh;'; + document.body.appendChild(chartDiv); + } + + /** Get the div element where the chart is displayed. */ + getChartCanvas() { + return document.getElementById(this.#chartName); + } + +} \ No newline at end of file