#Code samples: BARGRAPH Diagram

Code tips and tricks for beginners
Post Reply
User avatar
Oli
Posts: 47
Joined: Tue Feb 09, 2021 10:07 am
Location: Germany, Meissen
Has thanked: 13 times
Been thanked: 45 times
Contact:

#Code samples: BARGRAPH Diagram

Post by Oli »

This is a functioning demo, it is made very easy for better understanding.
Maybe there are more options (e.g. rotation), but I didn't find any.

I tried an alternative unsuccessfully, but I'm not a professional enough:
https://tobiasahlin.com/blog/introduction-to-chartjs/


I hope it helps someone, have fun ...

Code: [Local Link Removed for Guests]

cls
jsexternal "/bar-graph.js"' die datei bar-graph.js-1.gz  with content "html5-canvas-bar-graph.js" muss im root liegen

a$ = ""
a$ = a$ + |<p>The BARGRAPH Sample</p><canvas id="canvas0"></canvas>|
html a$

A$ = ""
A$ = A$ + |   var ctx= document.getElementById('canvas0').getContext('2d');|
A$ = A$ + |   |
A$ = A$ + |   var graph = new BarGraph(ctx);|
A$ = A$ + |   graph.maxValue = 100;|
'A$ = A$ + |   graph.margin = 2;| 'Distance
A$ = A$ + |   graph.width = 300;|
A$ = A$ + |   graph.height = 200;|
'A$ = A$ + |   graph.colors = ["#49a0d8", "green", "#ffc527", "red"];|         'optional colors
A$ = A$ + |   graph.xAxisLabelArr = ["Voltage", "Januar", "Power", "Temp"];|  
jscript a$


anf:
values$ = "10,90,20,80,66,1,88,33,12,99,34,28"
jscall " graph.update([ " + values$ + " ]); "

pause 1000
values$ = "50,50,50,50"
jscall " graph.update([ " + values$ + " ]); "

pause 1000
goto anf
You do not have the required permissions to view the files attached to this post.
Post Reply