|
Adding controls/button/etc to View that used DrawArea for drawing |
Posted by Sal on Sep-09-2015 00:18 |
|
Hi Peter,
I have been able to produce a series of Views containing different Plots (XY Chart) all been seen concurrently.
Not I am working in adding a 3D View containing series of points that will appear as a series of slices in the graph, which points are interconnected and filled by some color
I have been using ThreeDScatterChart as container to create the Chart and establish the Orientation, elevation, etc..
I have set the Scale manually and once I have done this I can map manually all the points of each slice to Pixel coordinates using
c->getXCoor() + c->getYCoor() methods
then use the drawing methods in DrawArea to show each set, since the 3D drawing methods do not allow to plot the way I want to
The above is quite tedious but necessary though is so similar to draw surfaces slices of points, that are expected to be originated from a common base elevation (WISH: it would be nice if a new class/method would be added for this...)
Objective:
I need to plot Points in surface areas not originated at the bottom of the graph using interconnected points - Imagine a series of more of less circular slices not necessarily equally centered, each of them having a colored lines that enclose the region to be painted with different shades of color
I accepted the fact that I am responsible to layer each set in such way that a new set is drawn over the set that is further from the user with because I am using the primitive drawing methods in DrawArea.
To stay in theme with the other views, I need to do the following:
1: How to add a TextBox to the View that uses the features of
pTextBox->setBackground(CompanyColorBackground, 0x0, Chart::cylinderEffect());
using d->text() method ?
I would like to add the cylinderEffect features used in other views that label the plot, which appear flat when compared to the appearance of other views that use the method I just mentioned
2: the 3D View has the requirement to have some control to alter the appearance of the data in the View been presented.
To stay in theme with the code I am replacing, they need to be layout over the window caption title name that should be drawn with the cylinder effect
I have done this (partially), but since the Client Area is considered the whole View, this forces redrawing the views more I would like, when for example acting of the controls
Any suggestion or sample code that illustrate how to do this in C++ ?
3: I also thought to plot in place of what I describe above 2 Charts into the same View as follow:
The top ones would have a ThreeDScatterChart that uses only the
pTextBox->setBackground() call only
and manages the events related to the Buttons I need to add the View
Below this view I would add the View that my code that is doing the 3D drawing
Is this an overkill ?
Should I be using "MultiChart" to accomplish the above ?
Do you have a sample for this ?
Though this is an available and may be better option, still I need contend with the controls layout and events
Thanks for any help, clarification and assistance you can supply
Sal |
Re: Adding controls/button/etc to View that used DrawArea for drawing |
Posted by Peter Kwan on Sep-10-2015 03:05 |
|
Hi Sal,
To create similar effect to:
pTextBox->setBackground(CompanyColorBackground, 0x0, Chart::cylinderEffect());
please use the following steps:
(a) Create the TTFText object using DrawArea.text
(b) Draw a rectangle using DrawArea.rect to act as the background of the text. The
TTFText object can be used to determine the width and height of the text. The
DrawArea.rect can use the Chart.cylinderEffect.
(c) Use the TTFText object to draw the text.
For user interface elements, there are many user interface elements in the MFC
framework. You can put them on the chart if you like. For example, if you need a
pushbutton over the chart title, please put the MFC pushbutton over the chart title.
If you must use your own code to create a pushbutton or other user interface element, it
is better if you just create the user interface using the standard MFC method (eg. by
subclassing an MFC control and override it). You can then put the control on the chart.
There are many MFC drawing functions that allow you to draw various things on the
control. The "cylinderEffect" is just a color gradient and should be achievable in any GUI
framework.
If you prefer to use ChartDirector's drawing functions instead of the MFC drawing
functions, there are several methods:
(a) You can create a separate CChartViewer control, with a small chart object that just
contains the control graphics you need (there is no need to create a large chart if you
just need a small part as the user interface). Then put that CChartViewer on top of the
CChartViewer that contains your scatter chart. This is equivalent to putting an MFC
control on top of your chart, in which the MFC control is another CChartViewer control.
(b) You can use the dynamic layer (see the Programming Track Cursor sample code) to
draw the control. This layer is ideal for drawing small simple objects on the chart that can
respond to mouse actions.
Hope this can help.
Regards
Peter Kwan |
Re: Adding controls/button/etc to View that used DrawArea for drawing |
Posted by Sal on Sep-10-2015 05:37 |
|
Thanks for your help and ideas
Sal |
|