Drawing lines in Photon

Hi ,

In one of my application, I need to plot the variations in current to
voltage.I used x-axis for current and y-axis for voltage.But , whenever I
try to plot x co-ordinate and y co-ordinate, it was taken with respect to
the top left corner.
I tried to use raw_canvas by adding my co-ordinate values
c1.x += raw_canvas.ul.x;
c1.y += raw_canvas.ul.y;
But, this resulted in the point shifting to a place with respect to the
top corner of the raw_canvas.

My requirement calls for drawing a trend curve, and I want to plot the
different points in the curve by means of a straight line. The (0,0) point
should be on the bottom left corner of the screen

Can anyone suggest some solution for this problem.

Bye.
M.Shanthi

M.Shanthi wrote:

Hi ,

In one of my application, I need to plot the variations in current to
voltage.I used x-axis for current and y-axis for voltage.But , whenever I
try to plot x co-ordinate and y co-ordinate, it was taken with respect to
the top left corner.
I tried to use raw_canvas by adding my co-ordinate values
c1.x += raw_canvas.ul.x;
c1.y += raw_canvas.ul.y;
But, this resulted in the point shifting to a place with respect to the
top corner of the raw_canvas.

My requirement calls for drawing a trend curve, and I want to plot the
different points in the curve by means of a straight line. The (0,0) point
should be on the bottom left corner of the screen

Can anyone suggest some solution for this problem.

Bye.
M.Shanthi

Compute the y coordinate of the data point by subtracting the data point

from the height of the raw_canvas. This will cause large data values to
have small y coordinate values and so be plotted at the top of the
canvas and will cause small data values to have large y coordinate
values and so be plotted at the bottom of the canvas.

Hi,


I’ve solved the problem by subtracting the y co-ordinates from the size of
the height of the canvas.
But, I want to allot the x-axis and y-axis with some incremental units,
say, 1,2,3 … 10.
How can we do this?

Bye,
M.Shanthi

M.Shanthi wrote:

Hi,


I’ve solved the problem by subtracting the y co-ordinates from the size of
the height of the canvas.

But, I want to allot the x-axis and y-axis with some incremental units,
say, 1,2,3 … 10.
I don’t understand what you are trying to do. Do you want to add scales?



How can we do this?

Bye,
M.Shanthi

John McClurkin <jwm@lsr.nei.nih.gov> wrote:
JM > M.Shanthi wrote:

Hi,


I’ve solved the problem by subtracting the y co-ordinates from the size of
the height of the canvas.

But, I want to allot the x-axis and y-axis with some incremental units,
say, 1,2,3 … 10.
JM > I don’t understand what you are trying to do. Do you want to add scales?



How can we do this?

Bye,
M.Shanthi

If you are trying to add some kind of grid, and you want your boxes to be
square, you need to be aware that most monitors have higher pixel density
across than the do up and down. I.E. you will need to scale your grid.

In other words, if you draw a square on the screen 100x100, it will look
slightly tall and thin on most monitors.

Hi,

When we try to draw a line with top left corner as (0,0), the straight
line drawn is linear till (99.9, 99.9). But , when we try to plot a line
from (0,0) to (100,100), there is steep increase in the straight line.We
expect an incremental change from (99.9, 99.9) to (100,100) but that does
not happen. For any value above (100,100), there is a cumulative increase
in the straight line.

Bye.
M.Shanthi