News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Super fast Charts

Started by Biterider, September 26, 2021, 07:05:59 PM

Previous topic - Next topic

Biterider

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

HSE

#1
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.
Equations in Assembly: SmplMath

Biterider

Hi HSE
Thanks for testing. I'll look into it. Until then, i'll delete the exe from the first post.

Biterider

fearless

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.

Biterider

Hi fearless
Good idea, I'll change it right now  :biggrin:

Biterider

Biterider

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

#6
deleted

jj2007


HSE

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

Hi HSE
Thanks for testing. I'll look into this issues.
QuoteSetup 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

#10
Quote from: Biterider on September 28, 2021, 05:55:40 AM
QuoteSetup 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.
Equations in Assembly: SmplMath

Biterider

Hi HSE
I'm sorry my friend, now I get it. Sometimes it takes me a little longer to understand...  :biggrin:

Biterider

Biterider

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

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

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