The MASM Forum

Projects => ObjAsm => Topic started by: Biterider on December 24, 2021, 03:54:10 AM

Title: Bar Charts
Post by: Biterider on December 24, 2021, 03:54:10 AM
Hi
For one of my projects, I need to display some data in the form of a bar chart.

Recently I showed the code for a super-fast XY chart (http://masm32.com/board/index.php?topic=9551.0). With that in mind, I refactored the code and added the necessary lines to draw the bars. I also customized the Series Setup tab for this type of chart.

In order to be able to read the data better, I added a tooltip to the float routine, which shows the series title, the description and the values. This behaviour can be switched on and off like the other features acting on the object flags on instance initialization. The code resembles the functionality of the InfoAreas implemented in TextView.

Since all these improvements were coded on the basic objects, the XY-Chart automatically gets them as well.  :thumbsup:

Attached are the new binaries demonstrating an XY-Chart and a Bar-Chart. The complete source code is on the code repository.

Have fun!

Biterider
Title: Re: Bar Charts
Post by: HSE on December 24, 2021, 06:53:01 AM
Hi Biterider!

   I cloned all the project just 5 minutes before update  :biggrin: :biggrin: I cloned again

   Fantastic!  :thumbsup:   

   You only have to improve X axis  :biggrin: 

   Really unusual that kind of axis in more knows graphic programs   :rolleyes: (or I don't know how to do that)

   That must look something like:
Title: Re: Bar Charts
Post by: HSE on December 24, 2021, 07:45:50 AM
 :biggrin:  Same idea a little more complex.

I don't have installed any screen capture yet. Fortunatelly Hutch's ScrCap (http://masm32.com/board/index.php?topic=8603.0) make the job  :thumbsup:

Apparently still work my now 20 years old program :eusa_snooty:
Title: Re: Bar Charts
Post by: Biterider on December 24, 2021, 05:33:01 PM
Hi HSE
Thanks for your feedback.  :thumbsup:

If you change the setting just a little, you can achieve something like in the attached picture.
But you are absolutely right, the x-axis can be done better.
This led me to further break up the rendering process, the way you can customize each element of the chart in child objects, like in this case.  :icon_idea:

Regards, Biterider
Title: Re: Bar Charts
Post by: HSE on December 24, 2021, 11:19:10 PM
 :thumbsup:
Title: Re: Bar Charts
Post by: Biterider on December 25, 2021, 08:24:10 PM
Hi
The code was prepared from the beginning to support an additional Y-axis (Y2 in the source code).
I will now spend some time implementing this.

It occurred to me that there might be a use case where you want to combine different types of plots into a single chart. I think it is possible to rearrange and refactor the code a little bit more to achieve this. Let's see how far I can get...  :cool:

Biterider
Title: Re: Bar Charts
Post by: HSE on December 26, 2021, 05:36:46 AM
Hi Biterider!

The code was prepared from the beginning to support an additional Y-axis (Y2 in the source code).
Usually is easy to draw against another Y-axis, problem is to draw more numeric scales. I can use any number of Y-axis, but scales are difficult, specially with more than 2 Y-axis. Any way, I never saw a graphic with more than 6 Y-axis. A posibilty to make thing more clear is to use partial Y-axis

It occurred to me that there might be a use case where you want to combine different types of plots into a single chart. I think it is possible to rearrange and refactor the code a little bit more to achieve this. Let's see how far I can get...  :cool:
Great  :thumbsup:

Regards, HSE.