User (Legacy) Posted August 6, 2002 Report Share Posted August 6, 2002 Hi, Being quite new to custom painting inside Chart FX Client Server I would like to ask you what to do to avoid the not wanted clipping. The attached CFXtrend2.zip contains full working example (see the information below). When drawing lines over the bars, the result looks fine -- see the attached bars.png picture. However, when gallery type is changed to LINES, then the green line is painted correctly only when you resize the window or so -- see the attached lines.png picture that was obtained when dragging the marker of the third point of the yellow serie. The painting code can be found inside CCfxEvents::Fire_PostPaint() method. Thanks for your kindness, time, and experience, Petr P.S. I did post the earlier version of this example recently. It displays the following explanatory text inside message box when started: ============================================================ This example demonstrates customization of the Chart FX painting. The code simulates drawing of the trend line with respect to series for values of each point (demo with 3 series and 3 points). The example shows 3 ways of determining coordinations of the end point of the lines. You can see the difference when you change the gallery to the lines instead of the bars. Try also to drag the top of the joined bars. Try to resize the chart area or the main window. The first (red) approach uses coordinations of the top of bars of the first and the last series of the first point. The second (blue) approach determines width of the area for one point and draw 3 lines with coordinations independent on values of the series (for the second point). The third (green) approach determines the x coordination of the line points with respect to the chosen gallery type of the first and of the last series. When BARs are used, it should behave the same way as the red case. When LINES are used, the x's are determined as in the blue case. You can observe some problem when using LINES and dragging the 3rd point markers. This example detects PostPaint events through the ICfxEvents interface. See SoftwareFX Knowledge Base "Q1381010. Handling events in Chart FX DLL" for details. The code is not necessarily pretty, nor extremely efficient. It is rather quick hack with reasonable style The example uses Cfx4032.dll via #import (VC++ 6.0). It uses only ATL::CWindowImpl<> methods and the Win32 GDI functions (which was one of the goals) in a very simple way. No MFC is used. If you are not familiar with ATL, you will probably be able to rewrite the code using GDI functions only. Enjoy, Petr P.S.: Feel free to use the code as an example, or for whatever purpose. ============================================================ -- Petr Prikryl (prikrylp at skil dot cz) Link to comment Share on other sites More sharing options...
Software FX Posted August 6, 2002 Report Share Posted August 6, 2002 The Dragging feature refreshes only the part of the screen that has changed. Because your custom painting goes beyond this area, only part of your line is drawn in the new position while the other remains unchanged. The solution: Refresh the whole chart when you receive a LButtonUp event. -- FP Software FX, Inc. Link to comment Share on other sites More sharing options...
User (Legacy) Posted August 7, 2002 Author Report Share Posted August 7, 2002 "SoftwareFX Support" wrote... > [...] The solution: Refresh the whole chart when you receive a LButtonUp event. Thanks! This works quite fine. The updated sample is attached. Just being curious, is it possible to avoid the "blink" when the chart is refreshed? When not using Refresh() and when the Refresh() is not needed, the window content behaves more smoothly. Thanks, Petr -- Petr Prikryl (prikrylp at skil dot cz) Link to comment Share on other sites More sharing options...
Software FX Posted August 7, 2002 Report Share Posted August 7, 2002 Try using Chart.TypeEx = Chart.TypeEx or CTE_SMOOTH This will do a double buffering. -- FP Software FX, Inc. Link to comment Share on other sites More sharing options...
User (Legacy) Posted August 8, 2002 Author Report Share Posted August 8, 2002 "SoftwareFX Support" wrote... > Try using Chart.TypeEx = Chart.TypeEx or CTE_SMOOTH > This will do a double buffering. -- FP, Software FX, Inc. Thanks, this works perfectly. The updated sample is attached. Petr Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.