Menu

How to make a bar graph on GLCD with HS1106 chip

2025-01-09
2025-01-10
  • Gert Klemmensen

    Gert Klemmensen - 2025-01-09

    Hi,

    I am new to the HS1106 GLCD display. So trying to learn how to use it.

    Among other things, I am trying to make a bar graph.

    I draw the outer frame with command:
    box (18,38,115,46)
    I make the bar graph with the command:
    FilledBox (20,40,x,44)

    As long as the bar graph gets longer (x gets bigger), there is no problem. But the other way the problem show up as the FilledBox command simply draws on top of the other boxes.

    Is there a smart and simple way to refresh the bar graph?

    Gert K.

     
  • Anobium

    Anobium - 2025-01-09

    I am not sure I understand the issue.

    Can you post some photos?

     

    Last edit: Anobium 2025-01-09
  • Anobium

    Anobium - 2025-01-10

    Taking a section of program from https://github.com/GreatCowBASIC/Demonstration_Sources/blob/main/GLCD_Solutions/GLCD_Gauge_Solutions/KS0108_Gauge_Solutions/GaugeDemo%20-%2048_24%20-%20millis.gcb#L232

    This section of the program draws boxes to manage the state. The dimensions of graph is 98, 9 to 127, 14.

    This draws a number of boxes dependent on value.

     IF value >0 Then 
            FilledBox 98, 9, 98 + value , 14, 1
            FilledBox 98 + value + 1, 9, 127, 14, 0
            Box 98 , 9, 127, 14, 1
        Else
            Box 98 , 9, 127, 14, 1
            FilledBox 99, 10, 126, 13, 0
        End If
    

    So, you will need to do the same. Draw multiple boxes and the outer frame.

     
    • Gert Klemmensen

      Gert Klemmensen - 2025-01-10

      I just tested with the method you show in your post above and it works perfectly. I couldn't get my head around it.

      Thank you very much!!

       

      Last edit: Gert Klemmensen 2025-01-10
  • Anobium

    Anobium - 2025-01-10

    Excellent.

    We only wrote this program ... this week!!! Amazing timing.

     
    👍
    1

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.