chart javascript wip playground

This commit is contained in:
DeltaLima 2025-04-10 23:48:50 +02:00
parent 9209b9b76b
commit 4607d47818
2 changed files with 9 additions and 3 deletions
playground/html/root

View file

@ -314,6 +314,12 @@ function DrawChart() {
if(ChartJson.chart[i].datapoints > datapointsMax) {
datapointsMax = ChartJson.chart[i].datapoints;
}
/* we are already interating through available charts, so we draw at this point the legend as well */
var ul = document.getElementById("chartLegend");
var li = document.createElement("li");
li.appendChild(document.createTextNode(ChartJson.chart[i].descr + ' (' + ChartJson.chart[i].name + ')'));
ul.appendChild(li);
}
/* https://www.w3schools.com/jsref/met_table_insertrow.asp */

View file

@ -123,12 +123,12 @@ gaugeJS_6_2_0.value('542.00', 2, ' ppm');
<br>
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/charts.css/dist/charts.min.css'><style>#chartDiv { width: 100%; max-width: 640px; margin: 0 auto; .minw { min-width: 140px; max-width: 320px; text-align: center; }}</style>
<button onClick='DrawChart();'>Go</button>
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/charts.css/dist/charts.min.css'><style>#chartDiv { width: 100%; max-width: 640px; margin: 0 auto; .minw { min-width: 140px; max-width: 320px; text-align: center; } }</style>
<div id='chartDiv'><table id='chartTable' class='charts-css line multiple show-data-on-hover show-heading show-primary-axis '>
<caption>Linechart</caption>
</table>
<ul class='charts-css legend'></ul>
<ul id='chartLegend' class='charts-css legend legend-line'></ul>
</div>
<script>DrawChart();</script>