The following methods allow you to modify the appearance of data in a graph and get information about current settings:
Method  | 
Information provided or set  | 
|---|---|
GetDataStyle  | 
The color, fill pattern, and other visual properties of a specified data point  | 
GetSeriesStyle  | 
The color, fill pattern, and other visual properties of a specified series  | 
SetDataStyle  | 
The color, fill pattern, and other visual properties for a specific data point  | 
SetSeriesStyle  | 
The color, fill pattern, and other visual properties for a series  | 
These Get methods return an instance of either the GraphDataStyle or GraphSeriesStyle class. The Set methods take a GraphDataStyle or GraphSeriesStyle object as an argument. Typically you use the Get method to obtain an instance of the class, specify new values for the properties you want to change, and then use the Set method to set the display properties.
Turn redrawing off
To
eliminate flicker that can occur because of interrelationships among properties,
call SetRedrawOff before calling the SetDataStyle and SetSeriesStyle methods,
then call SetRedrawOn to turn redrawing back
on and Refresh to display any pending visual
changes. For example:
dw1.SetRedrawOff() gobGraph.SetDataStyle(pointStyle) dw1.SetRedrawOn() dw1.Refresh()
The GraphSeriesStyle class has properties for background and foreground color, fill style and shade color, line color, style, and width, symbol style, and whether the data is an overlay. The GraphDataStyle class inherits from the GraphSeriesStyle class and adds a property, PieExplosionPercentage, that reports or sets the percentage that an exploded pie slice in a pie graph is moved away from the center of the pie in order to draw attention to the data.
The following example lets a user change a display property of a graph by double-clicking the property in a list view, which opens a dialog box in which the user can set properties.
Private Sub lvDataPoint_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles lvDataPoint.DoubleClick
  Dim lvi As ListViewItem
  Dim dialog As frmChooseStyle
  Dim pointStyle As Sybase.DataWindow.GraphDataStyle
  Dim gobGraph As Sybase.DataWindow.GraphicObjectGraph
 
  ' data point values are not editable
  If lvDataPoint.FocusedItem.Text.IndexOf("Value")  _
    =-1 Then
 
     ' clone the item with focus and send it off
     ' to dialog for processing
     lvi = lvDataPoint.FocusedItem.Clone()
     dialog = New frmChooseStyle(lvi)
 
     ' upon return update the real ListViewItem 
     ' with the change
     If dialog.ShowDialog() = DialogResult.OK Then
       lvDataPoint.FocusedItem.SubItems.Item(1) =  _
         lvi.SubItems.Item(1)
 
       ' get the current data point style
       gobGraph =  _
         CType(dw1.GetObjectByName("gr_1"),  _
         Sybase.DataWindow.GraphicObjectGraph)
       pointStyle =  _
          gobGraph.GetDataStyle(cbSeries.Text,  _
          nupDataPoint.Value)
 
       ' update data style depending on option 
       ' that changed
      Select Case lvDataPoint.FocusedItem.Text
      Case "Foreground Color"
         pointStyle.ForegroundColor =  _
         System.Drawing.Color.FromArgb(Val("&H" +  _
         lvi.SubItems.Item(1).Text))
      Case "Background Color"
         pointStyle.BackgroundColor =  _
         System.Drawing.Color.FromArgb(Val("&H" + _
         lvi.SubItems.Item(1).Text))
      Case "Shade Color"
         pointStyle.ShadeColor =  _
         System.Drawing.Color.FromArgb(Val("&H" +  _
         lvi.SubItems.Item(1).Text))
      Case "Line Color"
         pointStyle.LineColor =  _
         System.Drawing.Color.FromArgb(Val("&H" +  _
         lvi.SubItems.Item(1).Text))
      Case "Symbol Style"
         pointStyle.SymbolStyle =  _
         System.Enum.Parse(GetType  _
         (Sybase.DataWindow.SymbolStyle),  _
         lvi.SubItems.Item(1).Text, False)
      Case "Line Style"
        pointStyle.LineStyle =  _
        System.Enum.Parse(GetType  _
        (Sybase.DataWindow.LineStyle),  _
        lvi.SubItems.Item(1).Text, False)
      Case "Fill Pattern"
         pointStyle.FillStyle =  _
         System.Enum.Parse(GetType  _
         (Sybase.DataWindow.FillStyle),  _
         lvi.SubItems.Item(1).Text, False)
      Case "Line Width"
         pointStyle.LineWidth =  _
         Convert.ToInt32(lvi.SubItems.Item(1).Text)
       End Select
 
       ' apply the data style change
       gobGraph.SetDataStyle(pointStyle)
    End If
  End If
End Sub