[RESOLVED] Ai's Grok and ChatGPT cannot fix non-displaying Graph

Just starting out? Need help? Post your questions and find answers here.
User avatar
VB6_to_PBx
Enthusiast
Enthusiast
Posts: 632
Joined: Mon May 09, 2011 9:36 am

[RESOLVED] Ai's Grok and ChatGPT cannot fix non-displaying Graph

Post by VB6_to_PBx »

what's keeping the Graph from showing ??

Ai's Grok and ChatGPT cannot fix non-displaying Graph :

Code: Select all

Enumeration
  #Window
  #Canvas
EndEnumeration

; -------------------------------------------------
; Data
; -------------------------------------------------
Global Dim DataX.f(8)
Global Dim DataY.f(8)

DataX(0) = 0.200 : DataY(0) = 151.1
DataX(1) = 0.300 : DataY(1) = 225.6
DataX(2) = 0.400 : DataY(2) = 308.3
DataX(3) = 0.500 : DataY(3) = 384.1
DataX(4) = 0.600 : DataY(4) = 470.9
DataX(5) = 0.700 : DataY(5) = 517.7
DataX(6) = 0.800 : DataY(6) = 575.8
DataX(7) = 0.900 : DataY(7) = 625.3
DataX(8) = 1.000 : DataY(8) = 664.5

#POINTS = 8   ; highest index (0..8) = 9 points total

; -------------------------------------------------
; Settings
; -------------------------------------------------
Global MarginLeft   = 80
Global MarginRight  = 30
Global MarginTop    = 50
Global MarginBottom = 80
Global PointSize.f  = 6.0

; -------------------------------------------------
Procedure DrawGraph()
  Protected w  = GadgetWidth(#Canvas)
  Protected h  = GadgetHeight(#Canvas)
  Protected pw = w - MarginLeft - MarginRight
  Protected ph = h - MarginTop  - MarginBottom

  If pw < 10 Or ph < 10 : ProcedureReturn : EndIf

  If StartVectorDrawing(CanvasVectorOutput(#Canvas))

    ; Background first
    VectorSourceColor(#White)
    FillVectorOutput()

    ; Min/max
    Protected minX.f = DataX(0), maxX.f = DataX(0)
    Protected minY.f = DataY(0), maxY.f = DataY(0)
    Protected i

    For i = 0 To #POINTS
      If DataX(i) < minX : minX = DataX(i) : EndIf
      If DataX(i) > maxX : maxX = DataX(i) : EndIf
      If DataY(i) < minY : minY = DataY(i) : EndIf
      If DataY(i) > maxY : maxY = DataY(i) : EndIf
    Next

    ; padding
    Protected padX.f = (maxX - minX) * 0.05 : If padX = 0 : padX = 0.1 : EndIf
    Protected padY.f = (maxY - minY) * 0.05 : If padY = 0 : padY = 1.0 : EndIf
    minX = minX - padX : maxX = maxX + padX
    minY = minY - padY : maxY = maxY + padY

    Macro PX(x) : (MarginLeft + (x - minX)/(maxX - minX)*pw) : EndMacro
    Macro PY(y) : (MarginTop + ph - (y - minY)/(maxY - minY)*ph) : EndMacro

    ; Grid
    VectorSourceColor(RGB(235,235,235))
    Protected t.f
    For i = 0 To 10
      t = i/10
      MovePathCursor(MarginLeft + t*pw, MarginTop) : AddPathLine(MarginLeft + t*pw, MarginTop + ph)
      MovePathCursor(MarginLeft, MarginTop + t*ph) : AddPathLine(MarginLeft + pw, MarginTop + t*ph)
    Next
    StrokePath(1)

    ; Axes
    VectorSourceColor(#Black)
    MovePathCursor(MarginLeft, MarginTop)
    AddPathLine(MarginLeft, MarginTop + ph)
    AddPathLine(MarginLeft + pw, MarginTop + ph)
    StrokePath(3)

    ; Tick labels
    VectorFont(GetGadgetFont(#PB_Default), 12)
    For i = 0 To 10
      t = i/10
      Protected vx.f = minX + t*(maxX-minX)
      Protected vy.f = minY + t*(maxY-minY)

      MovePathCursor(PX(vx) - VectorTextWidth(StrF(vx,2))/2, MarginTop+ph+12)
      DrawVectorText(StrF(vx,2))

      MovePathCursor(MarginLeft - VectorTextWidth(StrF(vy,0))-10, PY(vy)-6)
      DrawVectorText(StrF(vy,0))
    Next

    ; Title
    VectorFont(GetGadgetFont(#PB_Default), 26)
    MovePathCursor(w/2 - VectorTextWidth("XY Data Graph")/2, 20)
    DrawVectorText("XY Data Graph")

    ; X label
    VectorFont(GetGadgetFont(#PB_Default), 20)
    MovePathCursor(w/2 - VectorTextWidth("X")/2, MarginTop + ph + 55)
    DrawVectorText("X")

    ; Y label (rotated)
    SaveVectorState()
    VectorFont(GetGadgetFont(#PB_Default), 20)
    TranslateCoordinates(26, h/2)
    RotateCoordinates(0, 0, -90)
    MovePathCursor(-VectorTextWidth("Y")/2, 0)
    DrawVectorText("Y")
    RestoreVectorState()

    ; Data line
    VectorSourceColor(RGB(0,120,255))
    MovePathCursor(PX(DataX(0)), PY(DataY(0)))
    For i = 1 To #POINTS
      AddPathLine(PX(DataX(i)), PY(DataY(i)))
    Next
    StrokePath(4)

    ; Data points
    VectorSourceColor(#Red)
    For i = 0 To #POINTS
      AddPathCircle(PX(DataX(i)), PY(DataY(i)), PointSize)
    Next
    FillPath()

    StopVectorDrawing()
  EndIf
EndProcedure

; -------------------------------------------------
; MAIN
; -------------------------------------------------
If OpenWindow(#Window, 0, 0, 900, 600, "PureBasic XY Graph - FIXED",
              #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_SizeGadget)

  CanvasGadget(#Canvas, 0, 0, WindowWidth(#Window), WindowHeight(#Window))

  BindGadgetEvent(#Canvas, @DrawGraph(), #PB_EventType_Resize)
  BindEvent(#PB_Event_SizeWindow, @DrawGraph())

  DrawGraph()

  Repeat
    Event = WaitWindowEvent()
  Until Event = #PB_Event_CloseWindow
EndIf

Last edited by VB6_to_PBx on Wed Nov 26, 2025 8:37 pm, edited 1 time in total.
 
PureBasic .... making tiny electrons do what you want !

"With every mistake we must surely be learning" - George Harrison
User avatar
STARGÅTE
Addict
Addict
Posts: 2265
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: Ai's Grok and ChatGPT cannot fix non-displaying Graph

Post by STARGÅTE »

Colors in VectorDrawing need to be full RGBA. Otherwise your colors are transparent.

Code: Select all

; Grid
VectorSourceColor(RGBA(235,235,235, 255))

Code: Select all

; Axes
VectorSourceColor(#Black|255<<24)
etc.
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 5010
Joined: Sun Apr 12, 2009 6:27 am

Re: Ai's Grok and ChatGPT cannot fix non-displaying Graph

Post by RASHAD »

Hi VB6_to_PBx
Long time no see

Code: Select all

Enumeration
  #Window
  #Canvas
EndEnumeration

; -------------------------------------------------
; Data
; -------------------------------------------------
Global Dim DataX.f(8)
Global Dim DataY.f(8)

DataX(0) = 0.200 : DataY(0) = 151.1
DataX(1) = 0.300 : DataY(1) = 225.6
DataX(2) = 0.400 : DataY(2) = 308.3
DataX(3) = 0.500 : DataY(3) = 384.1
DataX(4) = 0.600 : DataY(4) = 470.9
DataX(5) = 0.700 : DataY(5) = 517.7
DataX(6) = 0.800 : DataY(6) = 575.8
DataX(7) = 0.900 : DataY(7) = 625.3
DataX(8) = 1.000 : DataY(8) = 664.5

#POINTS = 8   ; highest index (0..8) = 9 points total

; -------------------------------------------------
; Settings
; -------------------------------------------------
Global MarginLeft   = 80
Global MarginRight  = 30
Global MarginTop    = 50
Global MarginBottom = 80
Global PointSize.f  = 6.0

; -------------------------------------------------
Procedure DrawGraph()
  Protected w  = GadgetWidth(#Canvas)
  Protected h  = GadgetHeight(#Canvas)
  Protected pw = w - MarginLeft - MarginRight
  Protected ph = h - MarginTop  - MarginBottom

  If pw < 10 Or ph < 10 : ProcedureReturn : EndIf

  If StartVectorDrawing(CanvasVectorOutput(#Canvas))

    ; Background first
    VectorSourceColor(RGBA(255,255,255,255))
    FillVectorOutput()

    ; Min/max
    Protected minX.f = DataX(0), maxX.f = DataX(0)
    Protected minY.f = DataY(0), maxY.f = DataY(0)
    Protected i

    For i = 0 To #POINTS
      If DataX(i) < minX : minX = DataX(i) : EndIf
      If DataX(i) > maxX : maxX = DataX(i) : EndIf
      If DataY(i) < minY : minY = DataY(i) : EndIf
      If DataY(i) > maxY : maxY = DataY(i) : EndIf
    Next

    ; padding
    Protected padX.f = (maxX - minX) * 0.05 : If padX = 0 : padX = 0.1 : EndIf
    Protected padY.f = (maxY - minY) * 0.05 : If padY = 0 : padY = 1.0 : EndIf
    minX = minX - padX : maxX = maxX + padX
    minY = minY - padY : maxY = maxY + padY

    Macro PX(x) : (MarginLeft + (x - minX)/(maxX - minX)*pw) : EndMacro
    Macro PY(y) : (MarginTop + ph - (y - minY)/(maxY - minY)*ph) : EndMacro

    ; Grid
    VectorSourceColor(RGBA(235,235,235,250))
    Protected t.f
    For i = 0 To 10
      t = i/10
      MovePathCursor(MarginLeft + t*pw, MarginTop) : AddPathLine(MarginLeft + t*pw, MarginTop + ph)
      MovePathCursor(MarginLeft, MarginTop + t*ph) : AddPathLine(MarginLeft + pw, MarginTop + t*ph)
    Next
    StrokePath(1)

    ; Axes
    VectorSourceColor(RGBA(0,0,0,255))
    MovePathCursor(MarginLeft, MarginTop)
    AddPathLine(MarginLeft, MarginTop + ph)
    AddPathLine(MarginLeft + pw, MarginTop + ph)
    StrokePath(3)

    ; Tick labels
    VectorFont(GetGadgetFont(#PB_Default), 12)
    For i = 0 To 10
      t = i/10
      Protected vx.f = minX + t*(maxX-minX)
      Protected vy.f = minY + t*(maxY-minY)

      MovePathCursor(PX(vx) - VectorTextWidth(StrF(vx,2))/2, MarginTop+ph+12)
      DrawVectorText(StrF(vx,2))

      MovePathCursor(MarginLeft - VectorTextWidth(StrF(vy,0))-10, PY(vy)-6)
      DrawVectorText(StrF(vy,0))
    Next

    ; Title
    VectorFont(GetGadgetFont(#PB_Default), 26)
    MovePathCursor(w/2 - VectorTextWidth("XY Data Graph")/2, 20)
    DrawVectorText("XY Data Graph")

    ; X label
    VectorFont(GetGadgetFont(#PB_Default), 20)
    MovePathCursor(w/2 - VectorTextWidth("X")/2, MarginTop + ph + 55)
    DrawVectorText("X")

    ; Y label (rotated)
    SaveVectorState()
    VectorFont(GetGadgetFont(#PB_Default), 20)
    TranslateCoordinates(26, h/2)
    RotateCoordinates(0, 0, -90)
    MovePathCursor(-VectorTextWidth("Y")/2, 0)
    DrawVectorText("Y")
    RestoreVectorState()

    ; Data line
    VectorSourceColor(RGBA(0,120,255,255))
    MovePathCursor(PX(DataX(0)), PY(DataY(0)))
    For i = 1 To #POINTS
      AddPathLine(PX(DataX(i)), PY(DataY(i)))
    Next
    StrokePath(4)

    ; Data points
    VectorSourceColor(RGBA(255,0,0,255))
    For i = 0 To #POINTS
      AddPathCircle(PX(DataX(i)), PY(DataY(i)), PointSize)
    Next
    FillPath()

    StopVectorDrawing()
  EndIf
EndProcedure

; -------------------------------------------------
; MAIN
; -------------------------------------------------
If OpenWindow(#Window, 0, 0, 900, 600, "PureBasic XY Graph - FIXED",
              #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_SizeGadget)

  CanvasGadget(#Canvas, 0, 0, WindowWidth(#Window), WindowHeight(#Window))

  BindGadgetEvent(#Canvas, @DrawGraph(), #PB_EventType_Resize)
  BindEvent(#PB_Event_SizeWindow, @DrawGraph())

  DrawGraph()

  Repeat
    Event = WaitWindowEvent()
  Until Event = #PB_Event_CloseWindow
EndIf


Egypt my love
User avatar
VB6_to_PBx
Enthusiast
Enthusiast
Posts: 632
Joined: Mon May 09, 2011 9:36 am

Re: Ai's Grok and ChatGPT cannot fix non-displaying Graph

Post by VB6_to_PBx »

STARGÅTE thanks that worked !
... just a Question :

Code: Select all

; Axes
VectorSourceColor(#Black|255<<24)
|255<<24 what does this actually do ??

-----------------------------------------------------

RASHAD many thanks for fixing Code !!!
would it be too much to add ability to ZoomIn and ZoomOut in the Graph ??
Also could you PM me ?
 
PureBasic .... making tiny electrons do what you want !

"With every mistake we must surely be learning" - George Harrison
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 5010
Joined: Sun Apr 12, 2009 6:27 am

Re: Ai's Grok and ChatGPT cannot fix non-displaying Graph

Post by RASHAD »

Just replace

Code: Select all

; -------------------------------------------------
; MAIN
; -------------------------------------------------
If OpenWindow(#Window, 0, 0, 900, 600, "PureBasic XY Graph - FIXED",
              #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_SizeGadget)

  CanvasGadget(#Canvas, 0, 0, WindowWidth(#Window), WindowHeight(#Window))

  BindGadgetEvent(#Canvas, @DrawGraph(), #PB_EventType_Resize)
  BindEvent(#PB_Event_SizeWindow, @DrawGraph())

  DrawGraph()

  Repeat
    Event = WaitWindowEvent()
  Until Event = #PB_Event_CloseWindow
EndIf
With

Code: Select all

; -------------------------------------------------
; MAIN
; -------------------------------------------------
If OpenWindow(#Window, 0, 0, 900, 600, "PureBasic XY Graph - FIXED",
              #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_SizeGadget)
              
  CanvasGadget(#Canvas, 0, 0, WindowWidth(#Window), WindowHeight(#Window))
  BindGadgetEvent(#Canvas, @DrawGraph(), #PB_EventType_Resize)
  BindEvent(#PB_Event_SizeWindow, @DrawGraph())

  DrawGraph()
  scale.d = WindowWidth(#Window)/WindowHeight(#Window)
  Repeat
    Select WaitWindowEvent()
      Case #PB_Event_CloseWindow
        Quit = 1
    
      Case #PB_Event_Gadget
        Select EventGadget()
          Case #Canvas
            Select EventType()
              Case #PB_EventType_MouseWheel
                value = GetGadgetAttribute(#Canvas,#PB_Canvas_WheelDelta )
                If value > 0
                  ;w = WindowWidth(#Window)+5
                  w = GadgetWidth(#Canvas)+5
                  h = w/scale
                  ;ResizeWindow(#Window,#PB_Ignore,#PB_Ignore ,w,h)
                  ResizeGadget(#Canvas,0,0,w,h)
                Else
                  ;w = WindowWidth(#Window)-5
                  w = GadgetWidth(#Canvas)-5
                  h = w/scale
                  ;ResizeWindow(#Window,#PB_Ignore,#PB_Ignore ,w,h)
                  ResizeGadget(#Canvas,0,0,w,h)
                EndIf      
            EndSelect
        EndSelect
      EndSelect 
    Until Quit = 1
  EndIf
Egypt my love
User avatar
STARGÅTE
Addict
Addict
Posts: 2265
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: Ai's Grok and ChatGPT cannot fix non-displaying Graph

Post by STARGÅTE »

VB6_to_PBx wrote: Wed Nov 26, 2025 8:25 am STARGÅTE thanks that worked !
... just a Question :

Code: Select all

; Axes
VectorSourceColor(#Black|255<<24)
|255<<24 what does this actually do ??

-----------------------------------------------------

RASHAD many thanks for fixing Code !!!
would it be too much to add ability to ZoomIn and ZoomOut in the Graph ??
Also could you PM me ?
255 is the alpha value and <<24 shifts this value 24 bits (3 bytes) to the left, finally | performs an Bit-OR operation between the 3-byte value #Black and the shifted alpha value
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
User avatar
mk-soft
Always Here
Always Here
Posts: 6390
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Ai's Grok and ChatGPT cannot fix non-displaying Graph

Post by mk-soft »

Simple

Code: Select all

; Axes
VectorSourceColor(#Black | $FF000000)
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
VB6_to_PBx
Enthusiast
Enthusiast
Posts: 632
Joined: Mon May 09, 2011 9:36 am

[RESOLVED]Re: Ai's Grok and ChatGPT cannot fix non-displaying Graph

Post by VB6_to_PBx »

[RESOLVED] my version of RASHAD , STARGATE, mk-soft, others .... Thank you very much for helping !!!

Code: Select all

EnableExplicit

Enumeration
  #Window
  #Canvas
EndEnumeration

; Sample data
Global Points = 24
Global Dim X.f(Points)
Global Dim Y.f(Points)
X(0)=0 : Y(0)=0
X(1)=30 : Y(1)=0.844389
X(2)=60 : Y(2)=1.330
X(3)=128 : Y(3)=2.184676
X(4)=195 : Y(4)=2.877518
X(5)=330 : Y(5)=4.058
X(6)=462 : Y(6)=5.053647
X(7)=594 : Y(7)=5.951790
X(8)=627 : Y(8)=6.166112
X(9)=660 : Y(9)=6.377
X(10)=703 : Y(10)=6.645075
X(11)=745 : Y(11)=6.906820
X(12)=830 : Y(12)=7.419941
X(13)=877 : Y(13)=7.696892
X(14)=924 : Y(14)=7.969510
X(15)=934 : Y(15)=8.026987
X(16)=957 : Y(16)=8.158513
X(17)=967 : Y(17)=8.215413
X(18)=990 : Y(18)=8.345647
X(19)=1000 : Y(19)=8.402
X(20)=1080 : Y(20)=8.847249
X(21)=1160 : Y(21)=9.283376
X(22)=1254 : Y(22)=9.785473
X(23)=1287 : Y(23)=9.959323
X(24)=1320 : Y(24)=10.132

; Margins
Global MarginLeft   = 50
Global MarginRight  = 20
Global MarginTop    = 20
Global MarginBottom = 50
Global PointSize.f  = 3.0

; -------------------------------
Procedure DrawGraph()
  Protected w = GadgetWidth(#Canvas)
  Protected h = GadgetHeight(#Canvas)
  If w < 10 Or h < 10 : ProcedureReturn : EndIf

  If StartVectorDrawing(CanvasVectorOutput(#Canvas))

    ; --- Clear background ---
    VectorSourceColor(RGBA(255,255,255,255))
    FillVectorOutput()

    ; --- Plot area ---
    Protected plotWidth.f  = w - MarginLeft - MarginRight
    Protected plotHeight.f = h - MarginTop - MarginBottom

    ; --- Find min/max ---
    Protected minX.f = X(0), maxX.f = X(0)
    Protected minY.f = Y(0), maxY.f = Y(0)
    Protected i
    For i = 1 To Points
      If X(i)<minX : minX=X(i) : EndIf
      If X(i)>maxX : maxX=X(i) : EndIf
      If Y(i)<minY : minY=Y(i) : EndIf
      If Y(i)>maxY : maxY=Y(i) : EndIf
    Next

    ; --- Grid lines ---
    Protected ticks = 28
    VectorSourceColor(RGBA(220,220,220,255)) ; light gray for grid

    ; Vertical grid (X)
    ;ticks = 20
    For i = 0 To ticks
      Protected t.f = i / ticks
      Protected px.f = MarginLeft + t*plotWidth
      MovePathCursor(Int(px), MarginTop)
      AddPathLine(Int(px), MarginTop + plotHeight)
      StrokePath(1)
    Next

    ; Horizontal grid (Y)
    ;ticks = 20
    For i = 0 To ticks
       t.f = i / ticks
      Protected py.f = MarginTop + plotHeight - t*plotHeight
      MovePathCursor(MarginLeft, Int(py))
      AddPathLine(MarginLeft + plotWidth, Int(py))
      StrokePath(1)
    Next

    ; --- Axes ---
    VectorSourceColor(RGBA(0,0,0,255))
    MovePathCursor(MarginLeft, MarginTop)
    AddPathLine(MarginLeft, MarginTop + plotHeight)             ; Y-axis
    AddPathLine(MarginLeft + plotWidth, MarginTop + plotHeight) ; X-axis
    StrokePath(3)

    ; --- Tick marks & labels ---
    VectorFont(GetGadgetFont(#PB_Default), 12)

    ; X-axis ticks
    ;ticks = 20
    For i = 0 To ticks
       t.f = i / ticks
       px.f = MarginLeft + t*plotWidth
      ; Tick line
      MovePathCursor(Int(px), MarginTop + plotHeight)
      AddPathLine(Int(px), MarginTop + plotHeight + 5)
      StrokePath(1)
      ; Label
      Protected label$ = StrF(minX + t*(maxX-minX), 0)
      MovePathCursor(Int(px)-VectorTextWidth(label$)/2, MarginTop + plotHeight + 8)
      DrawVectorText(label$)
    Next

    ; Y-axis ticks
    ;ticks = 20
    For i = 0 To ticks
       t.f = i / ticks
       py.f = MarginTop + plotHeight - t*plotHeight
      ; Tick line
      MovePathCursor(MarginLeft - 5, Int(py))
      AddPathLine(MarginLeft, Int(py))
      StrokePath(1)
      ; Label
       label$ = StrF(minY + t*(maxY-minY), 3)
      MovePathCursor(MarginLeft - VectorTextWidth(label$) - 8, Int(py)-6)
      DrawVectorText(label$)
    Next

    ; --- Draw data line ---
    VectorSourceColor(RGBA(0,120,255,255))
    Protected px1.f = MarginLeft + ((X(0)-minX)/(maxX-minX))*plotWidth
    Protected py1.f = MarginTop + plotHeight - ((Y(0)-minY)/(maxY-minY))*plotHeight
    MovePathCursor(Int(px1), Int(py1))
    For i = 1 To Points
      Protected px2.f = MarginLeft + ((X(i)-minX)/(maxX-minX))*plotWidth
      Protected py2.f = MarginTop + plotHeight - ((Y(i)-minY)/(maxY-minY))*plotHeight
      AddPathLine(Int(px2), Int(py2))
    Next
    StrokePath(2)

    ; --- Draw points ---
    VectorSourceColor(RGBA(255,0,0,255))
    For i = 0 To Points
       px.f = MarginLeft + ((X(i)-minX)/(maxX-minX))*plotWidth
       py.f = MarginTop + plotHeight - ((Y(i)-minY)/(maxY-minY))*plotHeight
      AddPathCircle(Int(px), Int(py), PointSize)
    Next
    FillPath()

    StopVectorDrawing()
  EndIf
EndProcedure

; -------------------------------
Procedure ResizeCanvas()

  CanvasGadget(#Canvas, 0, 0, WindowWidth(#Window), WindowHeight(#Window))
  DrawGraph()
EndProcedure

; -------------------------------
OpenWindow(#Window, 100, 100, 1200, 740, "DragStrip  ET  Data", #PB_Window_SystemMenu | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget)
CanvasGadget(#Canvas, 0, 0, WindowWidth(#Window), WindowHeight(#Window))

BindGadgetEvent(#Canvas, @ResizeCanvas(), #PB_EventType_Resize)
BindEvent(#PB_Event_SizeWindow, @ResizeCanvas())

DrawGraph()

Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow




 
PureBasic .... making tiny electrons do what you want !

"With every mistake we must surely be learning" - George Harrison
Post Reply