Tutorial 4. Manipulating Series and Graphs
In this
Tutorial, we will learn more series and graph manipulation techniques. It is recommended
that you read the
topics Property Grid and Graph Theme
before continue.
Series Properties
The user can customize a series by changing its properties with the Series Editor,
which can be opened by selecting the Series menu command on the Graph
menu or by double clicking on the series in the active graph. To demonstrate
this, open
the file ExamplesSample GraphsLines.dts in the DataScene installation folder
(which can be opened by selecting the Help: Demo Projects menu command).
Select the 3D Line graph document by clicking on its node in the Navigator.
Open the Series Editor by double
clicking on one of the three series in the 3D Line graph document.
Select in the Series list box 3DLine1 by left clicking on
it. In the property grid of the Series Editor, click on the value cell of the Name property that
contains the text "3D Line1". A text cursor is shown at the end of
the text. You may notice that a short description of the Name
property is shown at the bottom of the property grid. Now change the the text
from "3D Line1" to "First_3DLine" and press the ENTER key.
DataScene updates the name in the Series list box as well. From now on,
the name of the first series has become "First_3DLine".
Click the value cell of the ColorEach property. A dropdown button in the value
cell is shown. Click on this button and select True
in the dropdown list. This makes adjacent series pieces of the First_3DLine
series rendered in different colors. Select 3DLine2 in
the Series list box and select the Brush property in the property
grid. Click the editor button
to open the Brush
Editor.

Fig. 1. Invoking the Brush Editor by clicking on the editor
button in the value cell of the Brush property.
In the Brush
Editor, you will see a gradient brush is currently used to fill 3DLine2.
Switch to the Solid tab-page, select a color (e.g. green) and change the Transparency
to 50%. DataScene now uses a solid brush with the chosen transparent color to
fill 3DLine2. A few brush types (i.e. solid,
texture, gradient, image) with rich properties are supported in DataScene and can be customized with the Brush
Editor. You may want to experiment with these brush types and observe
their effects. After you are done, close the Brush
Editor.

Fig. 2. Application of a solid brush with a transparent color.
In the Series Editor, select the LinePen
property of 3DLine2 and open the Pen Editor.
Change the Color
properties (e.g. to green) in
the Pen Editor - which changes the color of the border
line of the 3DLine2 series. Accept the new
settings by clicking the OK button of the Pen
Editor.
In the Series Editor, switch to 3DLine3.
Select its Points property (under the Element category) in
the property grid and open the Point Editor.
In the Point Editor, check the Visible
check box and then click the OK button to close it. Close the Series Editor by
clicking on its OK button. The 3D Line graph document should look
similar to that shown in Fig. 3.

Fig. 3. The customized 3D Line graph document.
A few series piece properties, however, are not accessible through the Series Editor
if the series has the ColorEach property and it is set to True. These
include, for example, the individual series piece colors and few other properties (e.g. SliceExplosion and SliceHeight
properties of the slices of the Pie and Donut series). By default, DataScene uses colors in an internal color palette of the current
theme
to render individual series pieces if the ColorEach property of the series, if
any, is set to True. The user has the option to override these default
colors. This is demonstrated in the following example.
Open the file ExamplesSample GraphsPie.dts in the DataScene installation folder.
Select the Pie graph document and select its master graph as the active
graph. While pressing down and holding the Shift key, left click on the piece
(or the "slice") marked as "A" to open the Series Piece Editor. In the
Editor, change the Color property to purple and set
the SliceExplosion property to be 20. Accept the new settings by clicking
the OK button. You should see the effects as shown in Fig. 4.

Fig. 4. Slice A of the Pie series in the master graph is changed to purple
and exploded out.
Graph Manipulations
As mentioned in the topic Graph Document, graph
properties can be customized with tools on the ToolBox,
controls on the Graph
ToolBar, or menu commands on the Graph menu. In Tutorial 3,
we used the Graph Layout tool on the ToolBox
to arrange graph layout and used the Active
Graph combo-box on the Graph
ToolBar to select active graph. Now we will demonstrate changing graph
properties with the Graph menu.
Switch back to the 3D Line graph document of Lines.dts, open the Panel
Editor by selecting the Panel menu command on the Graph
menu. On the Appearance tab-page of the Panel
Editor, click the Background button to open the Brush
Editor. In the editor, select the Solid tab-page and then select the white
color. DataScene changes the background color of the graph panel
to white. Close the Brush
Editor and then the Panel Editor.
Select the Walls menu command to open the Wall
Editor. In the editor, select Back
in the Type combo-box and then click the Brush button to open the
Brush
Editor for the Back wall. In the Brush
Editor, select the Solid tab-page and then select the white
color. Close the Brush
Editor and then the Wall Editor.
Now the Back wall is also solid white.
Text Tool and Line Tool
The Text Tool and Line
Tool may be used to annotate a graph. With the 3D Line graph document
selected as the active graph document, click the Text Tool
on the ToolBox. Move the mouse onto the active graph and you
will notice that the mouse cursor changes to an I-Beam cursor -
indicative of the text inserting mode. Left click near the First_3DLine
series to open the Text Tool Editor. On the editor, enter "J0(x)",
where 0 should be marked as a subscript. Switch to the Frame tab-page and
check the Transparent check box to hide the bounding frame of the text
item. Click the OK button to close the Text Tool Editor. You may
want to move the text item to a more desired position by dragging it with the
left mouse. With the text item selected (with four small squares drawn around
it), press Ctrl + C and then Ctrl + V to copy it and then paste the
copied to the graph. Double click on the pasted text item to open the Text Tool Editor. Change the text
to "J1(x)" and then
close the editor. Move the pasted to a desired position near the 3DLine2
series. Repeat the above steps to create another text item with the text "J2(x)"
and move it near the 3DLine3 series. Press the Text Tool
again to deactivate it.
Activate the Line
Tool by clicking on it on the ToolBox. Draw a line with the left
mouse from the text item with the text "J0(x)" to the First_3DLine
series. Left double clicking the line item to open the Line Editor. On
the editor, select Wing Arrow in the Line Style combo-box and then
click the OK button to close the editor. Do the same for the other two
text items. Press the Line
Tool again to deactivate it. The 3D Line graph document now
should look similar to that shown in Fig. 5.

Fig. 5. The 3D Line graph document with text and line items.
Please note that left clicking on text/line items while the Ctrl key
is being pressed allows one to select or deselect the text/line items. Multiple
selected text/line items can be moved, copied, pasted, and deleted (by pressing
the Delete key) as a group.
You may want to practice with more graph tools on the ToolBox
or commands on the Graph menu.
Please keep in mind that any graph operations you perform affect only the active
graph of the selected graph document, and that any
series operations you perform affect only the active series.
Change the active graph with the Active
Graph combo-box and/or the active series with the
Active
Series combo-box so that you can operate on the desired graph and/or desired
series.
Graph Themes
With the Pie graph document selected as the active document, select Blue Sky
in the Graph Theme combo-box to change the theme for the graph document. The graph document should look
like that shown in Fig. 6. You may wan to experiment more graph themes.

Fig. 6. The Blue Sky theme is applied to the Pie graph
document.
If you want a specific theme to be applied automatically to any newly created graph
document, select the Options menu command on the View
menu to open the Program Options
dialog box. On the Appearance: Theme tab-page of the dialog box, check the Apply
Theme After Adding a New Graph checkbox and select in the Theme
combo-box the desired theme or specify a theme file in the Theme File text box to load
theme from.
Exporting Graphs
Right click on the Pie graph document to open the context menu. Select the Export menu command to open the
Export Graph dialog box. On the Graph tab-page of the
dialog box, select JPEG in the Format list box and
then click the Save button. Supply a file name in the Save As dialog box and then click its Save button. Open the saved file
in a JPEG viewer to see the exported graph.
You may want to experiment with other image formats. Please be aware that due
to the lack of native support of transparent color, color gradient, and hatch
brushes in the Postscript (PS) format, any graph using one of these elements
will look differently in the exported PS file. The same holds true for the
Portable Document Format (PDF).
Select the Close All menu command on the File
menu to close all opened projects. When prompted for saving the changes, click
the No button so that no changes made in this tutorial is saved.
See Also
|