Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 14:02 10 Jul 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : picoMite: Line Plot - I don't get it... need some help

Author Message
Amnesie
Guru

Joined: 30/06/2020
Location: Germany
Posts: 625
Posted: 06:50pm 08 Feb 2025
Copy link to clipboard 
Print this post

Hi all,

I am simply to stupid to understand this command. I am trying to simplify things with built-in features (usually I am using the simple line command). You may laugh, since this is easy for you  

To try this command I created a simple program:


Option explicit

Dim yData(7)

yData(1)=200
yData(2)=100
yData(3)=30
yData(4)=20
yData(5)=70
yData(6)=150
yData(7)=200

Dim integer nbr=7
Dim integer xstart=0
Dim integer xinc=10
Dim integer ystart=200
Dim integer yinc=1

CLS

Line plot yData(),nbr,xstart,xinc,ystart,yinc



What values do I need to choose for showing me ALL data-points?

If I start the program there is only one line plotted. I read the manual on page 119 and I tought "well that's easy".. but it is not.

My thinking:

nbr = all my datapoints I want to draw (since there are 7, I choose 7)
xstart = easy! just start at x-position 0
xinc = easy! to stretch the graph just draw eatch datapoint after 10 pixel
ystart = hmm y-position to start let's start @ y-pos = 200... uhm error:

"200 is invalid (valid is 0 to 7)" WHY? xstart has no problem with (for example 200)

if I choose ystart=1 it works.

yinc = I don't want to stretch this in the y-direction so I leave it on "1"...

aaaaaand as a result all the MMBASIC interpreter "plots" is just one line (segment).



Can anyone please give me one example in which a graph is plottet and is "streched" (x incremented by let's say 10 pixels or so)?

Greetings
Daniel
Edited 2025-02-09 04:55 by Amnesie
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10226
Posted: 07:02pm 08 Feb 2025
Copy link to clipboard 
Print this post

  Quote  Plots a line graph from an array of y-axis data points.
‘ydata’ is an array of floats or integers to be plotted
‘nbr ‘is the number of line segments to be plotted - defaults to the lesser of the
array size and MM.HRES-2 if omitted
‘xstart’ is the x-coordinate to start plotting - defaults to 0
‘xinc’ is the increment along the x-axis to plot each coordinate - defaults to 1
‘ystart’ is the location in ydata to start the plot - defaults to the array start
‘yinc’ is the increment in ydata to add for each point to be plotted
‘colour’ is the colour to draw the line


ystart allows you to omit y elements it does not scale them. You need to use MATH WINDOW to do the scaling. You have defined an 8 element array therefore the start can be between element 1 and element 7.
 
Amnesie
Guru

Joined: 30/06/2020
Location: Germany
Posts: 625
Posted: 07:07pm 08 Feb 2025
Copy link to clipboard 
Print this post

Ok, I understand. But even with "ystart=1" there is only plotted one single line element / segment instead of the whole graph...

if I set xinc=1 ALL data is plottet, but if I set xinc=10 only one is plotted...

MANUAL:

  Quote  xinc’ is the increment along the x-axis to plot each coordinate - defaults to 1


Yeah.. but as soon is the value is >1 less and less of the original graph is plotted..

I don't understand why.
Edited 2025-02-09 05:17 by Amnesie
 
Amnesie
Guru

Joined: 30/06/2020
Location: Germany
Posts: 625
Posted: 08:33pm 08 Feb 2025
Copy link to clipboard 
Print this post

Hm it must be some kind of bug, I tried any possible value and it doesn't make any sense. The manual states

  Quote  xinc’ is the increment along the x-axis to plot each coordinate, therefore it should draw all other yData() with this x increment value.


Can anybody test the code below or try to plot more than 7 datapoints with an incremented x value of "10"?

Just to be clear, this code should draw ALL datapoints as an graph, right?:


Option explicit

Dim yData(7)

yData(1)=200
yData(2)=100
yData(3)=30
yData(4)=20
yData(5)=70
yData(6)=150
yData(7)=200

Dim integer nbr=7
Dim integer xstart=0
Dim integer xinc=10
Dim integer ystart=1
Dim integer yinc=1

CLS

Line plot yData(),nbr,xstart,xinc,ystart,yinc



Because it does not. Only one line.

Greetings
Daniel
Edited 2025-02-09 06:37 by Amnesie
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10226
Posted: 09:31pm 08 Feb 2025
Copy link to clipboard 
Print this post

Looks like a bug - will fix
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6269
Posted: 09:54pm 08 Feb 2025
Copy link to clipboard 
Print this post

I agree. There does seem to be a problem with xinc
Tested on V6.00.01

No time to do further testing for now.
Hopefully later I will try earlier versions.

Jim
VK7JH
MMedit
 
Amnesie
Guru

Joined: 30/06/2020
Location: Germany
Posts: 625
Posted: 10:01pm 08 Feb 2025
Copy link to clipboard 
Print this post

  matherp said  Looks like a bug - will fix


Thanks a lot Peter, I've encountered this (probably bug) in earlier versions but was to afraid to ask  

Greetings
Daniel
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2603
Posted: 07:20am 09 Feb 2025
Copy link to clipboard 
Print this post

  Quote  picoMite: Line Plot -
While awaiting the fix a work-around is to use POLYGON.
The polygon has to be closed so at each end add a line down to the X axis (or other convenient place) and close along the X axis.
These lines can be hidden by drawing background colour lines over them.
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025