Ewon TechForum
Providing technical solutions to technical requests


Draw a circle on Java Script by using ViewOn
A_P_G Offline
Junior Member
#1
Hello,

 
I am using for my HTML page the ViewOn Software.
 
I want to draw a few circles using the JavaScript Section of ViewOn which will depend on two variables for the position of each circle.
 
Could someone help me with this issue, I have tried but always unsuccessful .


Thank you!
Kind Regards,

André Gonçalves
Reply

Ludo Offline
eWON Support
#2
Hey André,

Could you maybe share the viewON project with us?
And add extra information? Like what are the values, how do you want the circles to position, ... ?
Reply

A_P_G Offline
Junior Member
#3
Hello Ludo,

In ViewOn Software I inserted a new View and on the same View I went to "Action" -> "New" -> "Java Script Sections" and added a new "Java Script Section" and wrote the following code:

var c = document.getElementById("Circle1");
var ctx = c.getContext("2d");
ctx.beginPath();
ctx.arc(100755002 * Math.PI);
ctx.stroke();

I was expecting with this code to draw a circle on the View but it didn't draw. On ViewOn I didn't get any errors.
I don't want to draw manually because I have draw many circles depending on a Ewon variable which will give me a number.

Thank you
Reply

Ludo Offline
eWON Support
#4
Hi André,

Did you insert a < canvas> tag as well ?

What is your document.getElementById("Circle1") referring to? Do you have the relevant tag in your view?
You might need to create it as well through JS.

Your code is pure JS so should work without any trouble (https://jsfiddle.net/xn4o71qy/)
Reply

LewisH304 Offline
Junior Member
#5
Try this code!

JavaScript Code:
function draw()
{
var canvas = document.getElementById('circle');
if (canvas.getContext)
{
var ctx = canvas.getContext('2d');
var X = canvas.width / 2;
var Y = canvas.height / 2;
var R = 45;
ctx.beginPath();
ctx.arc(X, Y, R, 0, 2 * Math.PI, false);
ctx.lineWidth = 3;
ctx.strokeStyle = '#FF0000';
ctx.stroke();
}
}
Hope this helps!
Regards,
Lewis
Reply



Possibly Related Threads…
Photo Viewon Page Forbidden Started by Jon
0 Replies - 26 Views
03-04-2020, 09:48 PM
Last Post: Jon
01-04-2020, 08:32 PM
Last Post: mikeniemann
30-03-2020, 01:44 PM
Last Post: Baplu Sam
19-03-2020, 10:09 AM
Last Post: simon
  Viewon authentication Started by oliviersav
1 Replies - 225 Views
30-01-2020, 01:48 PM
Last Post: simon
  Viewon Started by insyncs
8 Replies - 1.170 Views
22-11-2019, 08:48 PM
Last Post: bryancit
13-11-2019, 03:44 PM
Last Post: Valentin59
  Viewon questions Started by insyncs
7 Replies - 802 Views
30-10-2019, 08:54 PM
Last Post: insyncs
15-07-2019, 01:03 PM
Last Post: jswenker
  Compteur ViewOn Started by alimemmi
0 Replies - 414 Views
05-07-2019, 04:41 PM
Last Post: alimemmi



Users browsing this thread:
1 Guest(s)



Theme © Ewon 2019 - Forum software by © MyBB - Cookie policy