Author Topic: Super fast Charts  (Read 3452 times)

Biterider

  • Moderator
  • Member
  • *****
  • Posts: 943
  • ObjAsm Developer
    • ObjAsm
Super fast Charts
« on: September 26, 2021, 07:05:59 PM »
Hi
One of my current private projects required a more professional chart to display measured data.
A few years ago, I wrote PlotXY in a form that I could no longer use. I also was not very happy looking at the code so I decided to rewrite it but reuse some of the old code blocks.  :icon_idea:

An important goal was to keep it as performant as possible, as it has to render several thousands of lines and markers. It quickly became clear to me that, under these circumstances, it was taking too much time for the old code to render parts of the diagram that were not visible. For this reason, I implemented a new line-clipping algorithm, described here http://masm32.com/board/index.php?topic=9518.0.

I wrote the code so that other chart types, such as bar charts, could be easily derived, reusing most of the common underlying infrastructure. The provided example in the attachment implements ChartXY, which is a series if (x, y) points, connected by straight lines.

I added code for gesture control, a general setup dialog, and some handy mouse interactions for moving and scaling the data. Use the left mouse button to drag the data, the scroll wheel to zoom in and out, the ctrl and shift keys and double clicking add more user functionality. The areas of the chart react differently to the interactions. All of these features can be enabled or disabled by setting some internal flags.
The input data type can be selected between REAL4 and REAL8 at compile time. All internal calculations are adjusted accordingly.

I compiled the code for 32 bit so that it can be viewed on machines that don’t support 64 bit.
There may be a bug or two in the code, so feedback is welcome.

To recompile the code, some newer files are required, which will only be available in the GitHub repo until the next official ObjAsm release.

I will replace the old Demo07 with this new architecture and say goodbye to the older PlotXY.

Regards, Biterider
« Last Edit: September 29, 2021, 03:55:33 AM by Biterider »

HSE

  • Member
  • *****
  • Posts: 2153
  • AMD 7-32 / i3 10-64
Re: Super fast Charts
« Reply #1 on: September 27, 2021, 05:34:21 AM »
Hi Biterider!!

Look promissory  :thumbsup:

Perhaps only work in Win 10 or so, because here there is problems with maximization, no setup, no wheel, etc.  :biggrin:

Regards, HSE.
« Last Edit: September 28, 2021, 06:27:35 AM by HSE »
Equations in Assembly: SmplMath

Biterider

  • Moderator
  • Member
  • *****
  • Posts: 943
  • ObjAsm Developer
    • ObjAsm
Re: Super fast Charts
« Reply #2 on: September 27, 2021, 06:09:19 AM »
Hi HSE
Thanks for testing. I'll look into it. Until then, i'll delete the exe from the first post.

Biterider

fearless

  • Member
  • ****
  • Posts: 553
    • Github
Re: Super fast Charts
« Reply #3 on: September 27, 2021, 01:00:57 PM »
Maybe add a link to your github profile in your signature, just in case hosting is an issue at some future time, that way there is a reference to the ObjAsm repo as well.
fearless

Lian Li PC-O11DW Case, ASUS Crosshair VIII Hero, AMD Ryzen 9 5950X, 32GB DDR4, MSI RX 5700XT, NZXT Kraken Z73, Seasonic 1000W PSU

My Github  Twitter  My Gitbook

Biterider

  • Moderator
  • Member
  • *****
  • Posts: 943
  • ObjAsm Developer
    • ObjAsm
Re: Super fast Charts
« Reply #4 on: September 28, 2021, 02:48:18 AM »
Hi fearless
Good idea, I'll change it right now  :biggrin:

Biterider

Biterider

  • Moderator
  • Member
  • *****
  • Posts: 943
  • ObjAsm Developer
    • ObjAsm
Re: Super fast Charts
« Reply #5 on: September 28, 2021, 02:54:13 AM »
Hi
I updated the first post with 2 executables.
The changes should address the repainting issue (wrong class sytles) nad the forwarding of the WM_MOUSEWHHEL message. Since Win10 has the option "scroll over inactive windows" activated by default, I didn't notice that a forwarding is necessary if this option is not activated or if the apps are executed on older operating systems..
Would be nice if you could check the apps again.

Thanks, Biterider

nidud

  • Member
  • *****
  • Posts: 2388
    • https://github.com/nidud/asmc
Re: Super fast Charts
« Reply #6 on: September 28, 2021, 03:39:31 AM »
deleted
« Last Edit: February 26, 2022, 05:14:06 AM by nidud »

jj2007

  • Member
  • *****
  • Posts: 12697
  • Assembler is fun ;-)
    • MasmBasic
Re: Super fast Charts
« Reply #7 on: September 28, 2021, 04:02:43 AM »
The download is eaten by Windows Defender.

Jotti finds absolutely nothing - strange for a Masm executable  :tongue:

HSE

  • Member
  • *****
  • Posts: 2153
  • AMD 7-32 / i3 10-64
Re: Super fast Charts
« Reply #8 on: September 28, 2021, 05:11:11 AM »
Hi Biterider!!

Tested in 32 bit:
Maximization is perfect now.
Wheel perfect now.
Setup only open in the bar where usually is title, but only after maximize mdichild.

Tested in 64 bit:
 - 64 bit file:
    look perfect (wheel, selected tab in setup, etc,)
    just a minor issue in tab "General" in text name of colors (no visible surely because high contrast), no problem in others tabs.
 - 32 bit file:
   Setup have same problem in all places. Look like setup is open but invisible, after press "esc" mdichild take focus again.

Regards, HSE.
Equations in Assembly: SmplMath

Biterider

  • Moderator
  • Member
  • *****
  • Posts: 943
  • ObjAsm Developer
    • ObjAsm
Re: Super fast Charts
« Reply #9 on: September 28, 2021, 05:55:40 AM »
Hi HSE
Thanks for testing. I'll look into this issues.
Quote
Setup only open in the bar where usually is title, but only after maximize mdichild.
I'm not sure if I understand you correctly...

Biterider

HSE

  • Member
  • *****
  • Posts: 2153
  • AMD 7-32 / i3 10-64
Re: Super fast Charts
« Reply #10 on: September 28, 2021, 06:25:39 AM »
Quote
Setup only open in the bar where usually is title, but only after maximize mdichild.
I'm not sure if I understand you correctly...
but it's very similar to english :biggrin:

If you activate "New" and you click in mdichild then no setup is visible.

If you maximize the newer child, then you can see setup, but only clicking in usual graphic title place.
« Last Edit: September 29, 2021, 05:13:42 AM by HSE »
Equations in Assembly: SmplMath

Biterider

  • Moderator
  • Member
  • *****
  • Posts: 943
  • ObjAsm Developer
    • ObjAsm
Re: Super fast Charts
« Reply #11 on: September 28, 2021, 06:48:23 AM »
Hi HSE
I'm sorry my friend, now I get it. Sometimes it takes me a little longer to understand...  :biggrin:

Biterider

Biterider

  • Moderator
  • Member
  • *****
  • Posts: 943
  • ObjAsm Developer
    • ObjAsm
Re: Super fast Charts
« Reply #12 on: September 29, 2021, 03:54:47 AM »
Okay, next try.  :cool:

I think I found the problem with the setup dialog positioned on the screen.

I also looked at the high contrast issue and found something that really surprised me. Standard window controls somehow recognize whether they are on a white or black background and adjust the text color accordingly. How they do that is a mystery. I simply fixed the problem with the ColorButtons by always setting the text color to black, at least until I understood the logic.

The new binaries are in the first post.

Biterder

HSE

  • Member
  • *****
  • Posts: 2153
  • AMD 7-32 / i3 10-64
Re: Super fast Charts
« Reply #13 on: September 29, 2021, 05:06:43 AM »
Hi Biterider!

Perfect now  :thumbsup:

Only legends are missing  :biggrin:

Here a picture of my rather primitive graphic to show legends (and title in same line to make economy of space)

Accidentally was captured the lecture of every point that I can make  :biggrin:
Equations in Assembly: SmplMath

Biterider

  • Moderator
  • Member
  • *****
  • Posts: 943
  • ObjAsm Developer
    • ObjAsm
Re: Super fast Charts
« Reply #14 on: September 29, 2021, 06:04:56 AM »
Hi HSE
Legends are actually missing. In terms of coding, they are expensive because you have to precalculate all the individual sizes, then arrange them according to some predefined preferences (bottom, right, stacked, etc.) and then rearrange the other diagram elements to make room for the legend. I thought about using TextView to add additional text formatting. The same goes for the chart title.
Btw, the description text on the General tab is implemented using TextView.
But at the moment the code suits my needs.

Incidentally, the control is also prepared for a Y2 scale.

Maybe I'll borrow your idea for the cursor to read out chart values. I have an unused function key. Maybe I can activate this feature by pressing [ALT] and moving the mouse.  :thumbsup:

But first of all, thanks for testing.

Biterider