Results 1 to 7 of 7

Thread: MSChart Control Legend

  1. #1
    Klicnik2001
    Guest
    I made a chart using MSChart control, and i just figured out how to get the legend on it. However, I have not been able to edit it.

    Anyone know how?
    Thanks

  2. #2
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238
    I think you only can chage the posistion, hide and show it during runtime.

    If you need further help, do let me know abt it

  3. #3
    Klicnik2001
    Guest

    nope

    I made some progress...

    Using this:
    MSChart1.ColumnLabel = "Whatever"

    This will change the Legend. However, Only the first line. I'm not sure how I can edit the 2nd to 4th lines..

    Anyone know?

    Thanks

  4. #4
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238
    okay... check out my MSChar sample code on my home page @ general section.

    Cheers~

  5. #5
    Member
    Join Date
    May 2000
    Location
    USA
    Posts
    37

    Talking

    Klicnik2001,

    Wow, I go mess around with a few different search engines and come back and find you've probably received the answers you were looking for while I was enjoying myself. OOPs! Oh, well I think I'll put in the results and the search engines URL's anyway.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    The MS Chart Control

    http://www.geocities.com/siliconvall.../9449/mschart/

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Microsoft Chart - A How To Guide For Handling The VB Beast (Lesson 1)

    http://www.gr-fx.com/toolshed/99_vbchart/vbchart1.htm

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    FIX: MSChart Legend Text Gets Truncated

    http://support.microsoft.com/support.../Q176/6/32.ASP

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    MSChart Control Example

    http://msdn.microsoft.com/library/de...artobjectx.htm

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    BUG: MSChart EditCopy Sends Incorrect Legends To Clipboard

    http://support.microsoft.com/support.../Q197/4/87.ASP

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    MSChart Control

    http://msdn.microsoft.com/library/de...hartobject.htm

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Legend Object Example

    http://msdn.microsoft.com/library/de...objlegendx.htm

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The search Engine's

    MSDN Online Search

    http://search.microsoft.com/us/dev/default.asp

    CodeHound

    http://www.codehound.com/

    SearchVB

    http://searchvb.techtarget.com/home/...2,sid8,00.html

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Hope this is helpful to someone.......
    Jerome W. Norgren

    "Know how to ask. There is nothing more difficult for some people, nor for others, easier."

    - Baltasar Gracian

  6. #6
    bwilson
    Guest

    Cool

    Here's a snipit of code that might help

    ElseIf SSTab1.Tab = 2 Then
    'define the data
    StatData2(0) = Val(lblBuyStat.Caption)
    StatData2(1) = Val(lblPawnStats.Caption)
    StatData2(2) = Val(lblLayaways.Caption)
    'attach the data to the chart
    MSChart2.ChartData = StatData2
    'control the display of frames and charts
    Frame3.Enabled = False
    Frame4.Enabled = False
    Frame7.Enabled = False
    lstNotes.Enabled = False
    lstNotes.ZOrder vbSendToBack
    Frame3.ZOrder vbSendToBack
    Frame4.ZOrder vbSendToBack
    MSChart3.ZOrder vbSendToBack
    Frame6.Enabled = True
    MSChart2.ZOrder vbBringToFront

    'display the statistics numerically
    Label48 = lblBuyStat.Caption
    Label39 = lblPawnStats.Caption
    Label40 = lblActivePawns.Caption
    Label41 = lblLayaways.Caption
    Label42 = lblRedeemStats.Caption
    Label43 = lblDefaultStats.Caption
    Label44 = lblRedeemStatsPercent.Caption
    Label45 = lblDefaultStatsPercent.Caption
    Label46 = lblActivePawnDollars.Caption
    Label47 = lblPawnHistory.Caption

    With MSChart2
    'set the font, max and min for the rectangle which contains the graph
    .Plot.LocationRect.Min.x = -1000
    .Plot.LocationRect.Max.x = 3000
    .Plot.LocationRect.Min.y = 400
    .Plot.LocationRect.Max.y = 2250
    .RowLabelCount = 2
    'set the font etc for the legend
    .Legend.VtFont.Name = "Times New Roman:"
    .Legend.VtFont.Style = VtFontStyleBold
    .Legend.VtFont.Size = 5.5
    .ColumnCount = 3

    'define the colors for the graph
    .Plot.SeriesCollection(1).DataPoints(-1).Brush.FillColor.Automatic = False
    .Plot.SeriesCollection(1).DataPoints(-1).Brush.FillColor.Set 255, 0, 200 'pink buy

    .Plot.SeriesCollection(2).DataPoints(-1).Brush.FillColor.Automatic = False
    .Plot.SeriesCollection(2).DataPoints(-1).Brush.FillColor.Set 0, 255, 0 'green active pawn

    .Plot.SeriesCollection(3).DataPoints(-1).Brush.FillColor.Automatic = False
    .Plot.SeriesCollection(3).DataPoints(-1).Brush.FillColor.Set 255, 255, 0 'yellow layaway
    'define the labels for the legend
    .DataGrid.ColumnLabel(1, 1) = "BUY" + " = " + lblBuyStat.Caption
    .DataGrid.ColumnLabel(2, 1) = "PAWN" + " = " + lblPawnStats.Caption
    .DataGrid.ColumnLabel(3, 1) = "LAYAWAYS" + " = " + lblLayaways.Caption

    If StatData2(0) + StatData2(1) + StatData2(2) = 0 Then 'all values zero
    .DataGrid.RowLabel(1, 1) = "NO TRANSACTIONS"
    Else
    'show the data value on the graph
    .Plot.SeriesCollection(1).DataPoints.item(-1).DataPointLabel.LocationType = VtChLabelLocationTypeInside
    .Plot.SeriesCollection(2).DataPoints.item(-1).DataPointLabel.LocationType = VtChLabelLocationTypeInside
    .Plot.SeriesCollection(3).DataPoints.item(-1).DataPointLabel.LocationType = VtChLabelLocationTypeInside
    'show the row title
    .DataGrid.RowLabel(1, 1) = " "
    End If
    End With

  7. #7
    New Member
    Join Date
    Jan 2010
    Posts
    1

    Re: nope

    Quote Originally Posted by Klicnik2001 View Post
    I made some progress...

    Using this:
    MSChart1.ColumnLabel = "Whatever"

    This will change the Legend. However, Only the first line. I'm not sure how I can edit the 2nd to 4th lines..

    Anyone know?

    Thanks
    here is the code for the question:

    .Column = 1
    .ColumnLabel = "first Legent"


    .Column = 2
    .ColumnLabel = "Second Legent"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width