The MASM Forum
Projects => ObjAsm => Topic started by: Biterider 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 (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
-
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.
-
Hi HSE
Thanks for testing. I'll look into it. Until then, i'll delete the exe from the first post.
Biterider
-
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.
-
Hi fearless
Good idea, I'll change it right now :biggrin:
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
-
deleted
-
The download is eaten by Windows Defender.
Jotti finds absolutely nothing (https://virusscan.jotti.org/en-US/filescanjob/dxyhz36p2y) - strange for a Masm executable :tongue:
-
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.
-
Hi HSE
Thanks for testing. I'll look into this issues.
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
-
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.
-
Hi HSE
I'm sorry my friend, now I get it. Sometimes it takes me a little longer to understand... :biggrin:
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
-
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:
-
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
-
they are expensive because you have to precalculate.
Yes. I use title and legends because any application have only one object that make 5-30 graphics with 2-6 series each.
I fixed in that line. And more series, shorter the names :biggrin:.
I noted that, unlike ObjAsm32 version, it don't adjust margins when don't have axis titles. :hmmm:
For sure I will have more ideas when I use the super fast chart :thumbsup:
PD: I almost forget that some weeks ago I maked several examples in the "Dark Side": Crecimiento Animal II (http://www.prodanimal.com.ar/mod/model5.htm#10)
To change "complejidad" modifies number of series.
-
Hi HSE
Very nice homepage.
The calculation model for the predictions appears to be complex. It all looks very professional. :thumbsup:
Biterider
-
Hi Biterider!
It all looks very professional. :thumbsup:
Thanks :thumbsup:
Regards, HSE.
-
deleted
-
Hi nidud
The only thing I did was changing some subroutines. It seems to me that a heuristic scanner detected a suspicious sequence of bytes and triggered a false positive result.
With the new compilation, this sequence is not there anymore and it passes the test.
Biterider
-
Hi Biterider,
I have a strange effect, if you drag the graph, then it randomly changes the labels, is that how it should be? :rolleyes:
Here's an example - https://i.ibb.co/GMpT7Xf/2021-09-29-14-17-38-Demo07.jpg
Thanks for the awesome implementation! :thup:
-
Hi LiaoMi
The scale labels are defined by the number of major divisions and minor divisions. They are set by the initial chart setup (in code) or the setup dialog. As you drag or zoom the data, the scales change automatically based on an algorithm to optimize the scale view, choosing the best combination of major and minor divisions.
Maybe it seems random, but there is a logic behind :biggrin:
Biterider
-
Hi,
Windows 8.1 ran both versions. They looked identical.
The program did not run on Windows XP.
Regards,
Steve N.
-
Hi FORTRANS
Thanks, that sounds reasonable. The oldest supported operating system for this code is Win7.
You could probably make it compatible with WinXP by foregoing some APIs. Unfortunately, I no longer have XP available.
Biterider
-
Hi LiaoMi
The scale labels are defined by the number of major divisions and minor divisions. They are set by the initial chart setup (in code) or the setup dialog. As you drag or zoom the data, the scales change automatically based on an algorithm to optimize the scale view, choosing the best combination of major and minor divisions.
Maybe it seems random, but there is a logic behind :biggrin:
Biterider
Hi Biterider,
this means that this is such a feature, I observed in other statistical programs that only with a zoom does such an effect occur, and when dragging, all the designations remain in place. Then, in order to display all the labels, I need to move the mouse until the labels appear :biggrin:
(https://www.funny-jokes.com/fun_pictures/cat_mouse_mat.jpg)
-
Hi LiaoMi
Good to hear from you :thumbsup:
Your description is correct. The method responsible for this behavior is ChartFlat.CalcScaleDivs. Based on the scale of min and max values, the number of decimal places, etc., it calculates the best combination. By "best" I mean the best for my particular application. I wrote this routine many years ago to visualize large measurement data series that I can zoom in to see some details and at the same time see the overall trend as I zoom out.
It is absolutely correct that it is not suitable for any other purpose. In this case this routine can be modified for a different behavior. :cool:
Biterider
-
Hi Biterider!!
Original LiaoMi observation refer to existence of 2 different methods: one initially and other after you make some interaction.
Regards, HSE.