BUG: Graph Axis Titles Don't Switch on Horizontal Bar GraphsLast reviewed: June 21, 1995Article ID: Q83463 |
The information in this article applies to:
- Professional Edition of Microsoft Visual Basic for Windows, versions 2.0 and 3.0- Microsoft Professional Toolkit for Microsoft Visual Basic programming system for Windows, version 1.0
SYMPTOMSThe Graph custom control allows you to convert your graph control from a non-horizontal bar graph to a horizontal bar graph or vice versa. This conversion will switch all necessary information to its proper position except for the axis titles. The BottomTitle and LeftTitle should switch positions, but do not.
WORKAROUNDAs a workaround for this problem, test whether the graph is being converted from or to a horizontal bar graph, and switch the values for BottomTitle and LeftTitle yourself. The example shown in the More Information section illustrates the problem and provides code to work around it.
STATUSMicrosoft has confirmed this to be a bug with the Graph custom control supplied with the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.
MORE INFORMATION
Step-by-Step Example1. Start Visual Basic or from the File menu, choose New Project (ALT,F, N) if Visual Basic is already running. Form1 is created by default.
Control Property Value ----------------------------------------------------- Command1 Caption Make Horizontal Command2 Caption Make Vertical Command3 Caption Switch Correctly Graph1 Width 4000 Graph1 Height 2500 Graph1 GraphType 3 (default) Graph1 GraphStyle 0 (default) Graph1 GraphData 10, 20, 30, 40, 50 Graph1 BottomTitle Title for axis labeled 1-5 Graph1 LeftTitle Title for axis labeled 0-50
Sub Command1_Click () Graph1.GraphStyle = 1 'horizontal Graph1.DrawMode = 2 ' redraws graph with new properties End Sub
Sub Command2_Click () Graph1.GraphStyle = 0 'default (vertical) Graph1.DrawMode = 2 ' redraws graph with new properties End Sub
Sub Command3_Click () Const TRUE = 1 OldStyle = Graph1.GraphStyle Graph1.GraphType = 3 'or change according to your needs Graph1.GraphStyle = 1 'or change according to your needs If (Graph1.GraphType=3) Or (Graph1.GraphType=4) Then BarGraph%=TRUE ' The next line of code takes advantage of the fact that the ' GraphStyle numbers for the horizontal bar graphs are odd and the ' vertical are even. If (Graph1.GraphStyle + OldStyle) Mod 2 = 1 Then Switched% = TRUE If BarGraph% And Switched% Then temp$ = Graph1.BottomTitle Graph1.BottomTitle = Graph1.LeftTitle Graph1.LeftTitle = temp$ End If Graph1.DrawMode = 2 End Sub When you run the program and click the Command1 button, Graph1 will redraw itself as a horizontal graph. The left and bottom labels switched but the LeftTitle and BottomTitle do not. Next, click the Command2 button. The Command2 Click event will return the graph to its original appearance. When you click the Command3 button, Graph1 will redraw itself as a horizontal graph with all labels and titles switched appropriately. The code for the Command3 Click event was written to react appropriately, regardless of which GraphType and GraphStyle are chosen.
|
Additional reference words: buglist1.00 buglist2.00 buglist3.00 1.00 2.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |