Results 1 to 31 of 31

Thread: [RESOLVED] auto resize RMchart when resizing form

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2008
    Location
    Netherlands
    Posts
    105

    Resolved [RESOLVED] auto resize RMchart when resizing form

    I have made a chart with rmchart and i was wondering if it is possible to automatically resize the chart when i resize the form where it's in.

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: auto resize RMchart when resizing form

    Ive never used rmchart but you should be able to set its size and location properties.

    Code:
    Option Explicit
    
    Private Sub Form_Resize()
        If Me.WindowState <> vbMinimized Then
            RMChart1.Left = 0
            RMChart1.Top = 0
            RMChart1.Width = Me.ScaleWidth
            RMChart1.Height = Me.ScaleHeight
        End If
    End Sub
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jan 2008
    Location
    Netherlands
    Posts
    105

    Re: auto resize RMchart when resizing form

    This doesn't seem to work.

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: auto resize RMchart when resizing form

    Well since I dont have the control you need to tell us if it has those properties or not?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jan 2008
    Location
    Netherlands
    Posts
    105

    Re: auto resize RMchart when resizing form

    It's a special kind of chart where you need a rmchart.dll file. You can find information on it at www.rmchart.com
    The properties that this chart has is nog clear to me.

  6. #6
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Re: auto resize RMchart when resizing form

    This works for me.

    vb Code:
    1. Dim x As Single
    2. Dim y As Single
    3.  
    4. Private Sub Form_Load()
    5. x = RMChartX1.Height / Me.ScaleHeight
    6. y = RMChartX1.Width / Me.ScaleWidth
    7.  
    8. End Sub
    9.  
    10. Private Sub Form_Resize()
    11. RMChartX1.Height = Me.ScaleHeight * x
    12. RMChartX1.Width = Me.ScaleWidth * y
    13.  
    14. End Sub

  7. #7
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: auto resize RMchart when resizing form

    Properties are a basic "thing" of programming. You really should check out a book on VB 6 then to help get you up to speed on the basics.

    A property is just like in languages you speak, adjectives describe a noun. A Property describes an object.

    .Width, .Height, .Top and .Left are all describing your chart object and are all properties.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Jan 2008
    Location
    Netherlands
    Posts
    105

    Re: auto resize RMchart when resizing form

    Quote Originally Posted by lintz
    This works for me.

    vb Code:
    1. Dim x As Single
    2. Dim y As Single
    3.  
    4. Private Sub Form_Load()
    5. x = RMChartX1.Height / Me.ScaleHeight
    6. y = RMChartX1.Width / Me.ScaleWidth
    7.  
    8. End Sub
    9.  
    10. Private Sub Form_Resize()
    11. RMChartX1.Height = Me.ScaleHeight * x
    12. RMChartX1.Width = Me.ScaleWidth * y
    13.  
    14. End Sub
    This will probably work if you have created a chart with the rmchart.dll. But if you have created it with the rmcdesigner this doesn't seem to work.

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Jan 2008
    Location
    Netherlands
    Posts
    105

    Re: auto resize RMchart when resizing form

    Here is the code that this program has created:

    Code:
    Sub DoTheChart()
        Dim i As Long
        Dim nC As Long
        Dim nDataCount As Long
        Dim nDataXCount As Long
        Dim nDataYCount As Long
        Dim nRetVal As Long
        Dim sTemp As String
        ReDim aData(0) As Double
        ReDim aData2(0) As Double
        ReDim aPPC(0) As Long
        ReDim aColor(0) As Long
        Dim tChart As tRMC_CHART
        Dim tRegion As tRMC_REGION
        Dim tCaption As tRMC_CAPTION
        Dim tLegend As tRMC_LEGEND
        Dim tGrid As tRMC_GRID
        Dim tDataAxis As tRMC_DATAAXIS
        Dim tLabelAxis As tRMC_LABELAXIS
        Dim tBarSeries As tRMC_BARSERIES
        Dim tLineSeries As tRMC_LINESERIES
        Dim tGridlessSeries As tRMC_GRIDLESSSERIES
        Dim tXYAxis As tRMC_XYAXIS
        Dim tXYSeries As tRMC_XYSERIES
     
     
        '************** Create the chart **********************
        tChart.nLeft = 10
        tChart.nTop = 90
        tChart.nWidth = 900
        tChart.nHeight = 700
        tChart.nBackColor = Transparent
        tChart.nCtrlStyle = RMC_CTRLSTYLEFLAT
        tChart.sBgImage = ""
        tChart.sFontName = "Tahoma"
        tChart.nToolTipWidth = 0
        tChart.nBitmapBKColor = Default
        nRetVal = RMC_CreateChartOnDCI(Me.hDC, ID_RMC1, tChart)
        If nRetVal < 0 Then GoTo IsError
        '************** Add Region 1 *****************************
        tRegion.nLeft = 10
        tRegion.nTop = 10
        tRegion.nWidth = -5
        tRegion.nHeight = -5
        tRegion.sFooter = ""
        tRegion.nShowBorder = False
        nRetVal = RMC_AddRegionI(ID_RMC1, tRegion)
        If nRetVal < 0 Then GoTo IsError
        '************** Add caption to region 1 *******************
        tCaption.sText = "Modus Svs"
        tCaption.nBackColor = Default
        tCaption.nTextColor = Default
        tCaption.nFontSize = 10
        tCaption.nIsBold = False
        nRetVal = RMC_AddCaptionI(ID_RMC1, 1, tCaption)
        If nRetVal < 0 Then GoTo IsError
        '************** Add grid to region 1 *****************************
        tGrid.nGridBackColor = Default
        tGrid.nAsGradient = True
        tGrid.nBiColor = RMC_BICOLOR_NONE
        tGrid.nLeft = 0
        tGrid.nTop = 0
        tGrid.nWidth = 0
        tGrid.nHeight = 0
        nRetVal = RMC_AddGridI(ID_RMC1, 1, tGrid)
        If nRetVal < 0 Then GoTo IsError
        '************** Add first X axis to region 1 *****************************
        tXYAxis.nAlignment = RMC_XAXISBOTTOM
        tXYAxis.nMinValue = 0
        tXYAxis.nMaxValue = 400
        tXYAxis.nTickCount = 9
        tXYAxis.nFontSize = 8
        tXYAxis.nTextColor = Default
        tXYAxis.nLineColor = Gray
        tXYAxis.nLinestyle = RMC_LINESTYLEDASH
        tXYAxis.nDecimalDigits = 0
        tXYAxis.sUnit = ""
        tXYAxis.sText = "Diepte [m]"
        tXYAxis.sLabels = ""
        nRetVal = RMC_AddXAxisI(ID_RMC1, 1, tXYAxis)
        If nRetVal < 0 Then GoTo IsError
        '************** Add first Y axis to region 1 *****************************
        tXYAxis.nAlignment = RMC_YAXISLEFT
        tXYAxis.nMinValue = Menu.Yas1
        tXYAxis.nMaxValue = Menu.Yas2
        tXYAxis.nTickCount = 11
        tXYAxis.nFontSize = 8
        tXYAxis.nTextColor = Default
        tXYAxis.nLineColor = Gray
        tXYAxis.nLinestyle = RMC_LINESTYLEDASH
        tXYAxis.nDecimalDigits = 0
        tXYAxis.sUnit = ""
        tXYAxis.sText = "Geluidssnelheid [m/s]"
        tXYAxis.sLabels = ""
        nRetVal = RMC_AddYAxisI(ID_RMC1, 1, tXYAxis)
        If nRetVal < 0 Then GoTo IsError
        '************** Add Series 1 to region 1 *******************************
        tXYSeries.nColor = Navy
        tXYSeries.nStyle = RMC_XY_LINE
        tXYSeries.nLinestyle = RMC_LSTYLE_LINE
        tXYSeries.nSeriesSymbol = RMC_SYMBOL_NONE
        tXYSeries.nWhichXAxis = RMC_XAXISBOTTOM
        tXYSeries.nWhichYAxis = RMC_YAXISLEFT
        tXYSeries.nValueLabelOn = RMC_VLABEL_NONE
        nRetVal = RMC_AddXYSeriesI(ID_RMC1, 1, aData(0), 0, aData2(0), 0, tXYSeries)
        If nRetVal < 0 Then GoTo IsError
        '****** Set name and parameters for the X-datafile for series 1 ******
        nRetVal = RMC_SetSeriesDataFile(ID_RMC1, 1, 1, "C:\modus svs\Testfile modus svs.csv", "1,1500", "2", ";", False)
        If nRetVal < 0 Then GoTo IsError
        '****** Set name and parameters for the Y-datafile for series 1 ******
        nRetVal = RMC_SetSeriesDataFile(ID_RMC1, 1, 1, "C:\modus svs\Testfile modus svs.csv", "1,1500", "1", ";", True)
        If nRetVal < 0 Then GoTo IsError
     
        nRetVal = RMC_SetWatermark(RMC_USERWM, RMC_USERWMCOLOR, RMC_USERWMLUCENT, RMC_USERWMALIGN, RMC_USERFONTSIZE)
        nRetVal = RMC_Draw(ID_RMC1)
        If nRetVal < 0 Then GoTo IsError
        Exit Sub
     
    IsError:
    End Sub
    Maybe you can see how you can resize this chart.

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Jan 2008
    Location
    Netherlands
    Posts
    105

    Re: auto resize RMchart when resizing form

    This seems to work.

    Code:
    Private Sub Form_Resize()
       Chart.Cls
       DoTheChart
    In the chart i have used this code:

    Code:
        
    tChart.nWidth = Chart.ScaleWidth-50
    tChart.nHeight = form.ScaleHeight - 100
    This will only make de program a bit slow.

  11. #11
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: auto resize RMchart when resizing form

    Where do you have the .nWidth and .nHeight code? In the Form_Resize? If so and its still slow then its the limitation of the chart control you are using.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  12. #12

    Thread Starter
    Lively Member
    Join Date
    Jan 2008
    Location
    Netherlands
    Posts
    105

    Re: auto resize RMchart when resizing form

    That code i have put in the procedure dothechart.
    What makes it slow is that with every resize i do with the form it has to clear the form and rebuild the chart. I hope there is a better way, but it does work.

  13. #13
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: auto resize RMchart when resizing form

    Well the resize event is the correct place to set the size of the chart but if the chart control requires you to rebuild the entire thing to resize the chart then thats not good at all. Maybe you would want to use a better cahrt control.

    Did you read any of the documentation that is for the chart control?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  14. #14

    Thread Starter
    Lively Member
    Join Date
    Jan 2008
    Location
    Netherlands
    Posts
    105

    Re: auto resize RMchart when resizing form

    There isn't any information about the chart controle for the chart that is created in rmcdesigner. If i want to use the chart controle of rmchart i have to build a whole new chart by hand and i don't know how to do that yet.

  15. #15
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: auto resize RMchart when resizing form

    Doesnt the MSChart control in the vb 6 toolbox work well enough? Its alot easier to use but may not have alot of fancy chart designs.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  16. #16
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Re: auto resize RMchart when resizing form

    You don't need to keep creating the chart each time you resize the form. If you simply resize the chart (width and height) when the form is resized everything will be OK

  17. #17
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: auto resize RMchart when resizing form

    Thats what I thought and mentioned it in post #2 but he says it doesnt work.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  18. #18

    Thread Starter
    Lively Member
    Join Date
    Jan 2008
    Location
    Netherlands
    Posts
    105

    Re: auto resize RMchart when resizing form

    Quote Originally Posted by lintz
    You don't need to keep creating the chart each time you resize the form. If you simply resize the chart (width and height) when the form is resized everything will be OK
    This may work for the mschart, but this doesn't work with a chart created with rcmdesigner.
    I will try to create the chart with mschart then. First have to find out how this works.

  19. #19

    Thread Starter
    Lively Member
    Join Date
    Jan 2008
    Location
    Netherlands
    Posts
    105

    Re: auto resize RMchart when resizing form

    Can someone tell me where to find a good tutorial on creating a chart with mschart on the internet?

    I want to create a chart with mschart and the data he has to get form a text file, can someone help me on how to start?
    Last edited by xavier73; Jan 20th, 2008 at 08:27 AM.

  20. #20
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: auto resize RMchart when resizing form

    Well first of all add it to your toolbox and drop it on to a form.
    Resizing it is a single line of code.

    Code:
    Option Explicit
    
    Private Sub Form_Resize()
        MSChart1.Move 0, 0, Me.ScaleWidth, Me.ScaleHeight
    End Sub
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  21. #21

    Thread Starter
    Lively Member
    Join Date
    Jan 2008
    Location
    Netherlands
    Posts
    105

    Re: auto resize RMchart when resizing form

    Oke that is if you have a chart created with mschart. I have created it with RMchart. Now i have to find out how to create a mschart.

  22. #22
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: auto resize RMchart when resizing form

    Yes, but didnt you try it? Drop a chart control on to your form and add the posted code. Now it will resize easily and the rest is just populating its properties and so fourth to suit your needs.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  23. #23

    Thread Starter
    Lively Member
    Join Date
    Jan 2008
    Location
    Netherlands
    Posts
    105

    Re: auto resize RMchart when resizing form

    No i didn't try it because i don't know how to create one yet.

  24. #24
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Re: auto resize RMchart when resizing form

    Give this a shot. Add a instance of the RMChart control and Command Button.

    vb Code:
    1. Option Explicit
    2.  
    3. Dim x As Single
    4. Dim y As Single
    5.  
    6. Private Sub Form_Load()
    7.  
    8. x = RMChartX1.Height / Me.ScaleHeight
    9. y = RMChartX1.Width / Me.ScaleWidth
    10.        
    11. End Sub
    12.  
    13.        
    14. Private Sub Form_Resize()
    15.  
    16. RMChartX1.Height = Me.ScaleHeight * x
    17. RMChartX1.Width = Me.ScaleWidth * y
    18.  
    19. End Sub
    20.  
    21. Private Sub Command1_Click()
    22.  ' Single bars
    23.     Dim nRetval As Long
    24.     Dim sTemp As String
    25.    
    26.     With RMChartX1
    27.         '************** Design the chart **********************
    28.         .Font = "Comic Sans MS"
    29.         .RMCBackColor = AliceBlue
    30.         .RMCStyle = RMC_CTRLSTYLEFLAT
    31.        
    32.         '************** Add Region 1 *****************************
    33.         .AddRegion
    34.         With .Region(1)
    35.             .Left = 5
    36.             .Top = 5
    37.             .Width = -5
    38.             .Height = -5
    39.             .Footer = ""
    40.             '************** Add caption to region 1 *******************
    41.             .AddCaption
    42.             With .Caption
    43.                 .Titel = "This is the chart's caption"
    44.                 .BackColor = Blue
    45.                 .TextColor = Yellow
    46.                 .FontSize = 11
    47.                 .Bold = True
    48.             End With 'Caption
    49.             '************** Add grid to region 1 *****************************
    50.             .AddGrid
    51.             With .Grid
    52.                 .BackColor = Beige
    53.                 .AsGradient = False
    54.                 .BicolorMode = RMC_BICOLOR_LABELAXIS
    55.                 .Left = 0
    56.                 .Top = 0
    57.                 .Width = 0
    58.                 .Height = 0
    59.             End With 'Grid
    60.             '************** Add data axis to region 1 *****************************
    61.             .AddDataAxis
    62.             With .DataAxis(1)
    63.                 .Alignment = RMC_DATAAXISLEFT
    64.                 .MinValue = 0
    65.                 .MaxValue = 100
    66.                 .TickCount = 11
    67.                 .FontSize = 8
    68.                 .TextColor = Black
    69.                 .LineColor = Black
    70.                 .LineStyle = RMC_LINESTYLEDOT
    71.                 .DecimalDigits = 0
    72.                 .AxisUnit = ""
    73.                 .AxisText = ""
    74.             End With 'DataAxis(1)
    75.             '************** Add label axis to region 1 *****************************
    76.             .AddLabelAxis
    77.             With .LabelAxis
    78.                 .AxisCount = 1
    79.                 .TickCount = 5
    80.                 .Alignment = RMC_LABELAXISBOTTOM
    81.                 .FontSize = 8
    82.                 .TextColor = Black
    83.                 .TextAlignment = RMC_TEXTCENTER
    84.                 .LineColor = Black
    85.                 .LineStyle = RMC_LINESTYLENONE
    86.                 sTemp = "Label 1*Label 2*Label 3*Label 4*Label 5"
    87.                 .LabelString = sTemp
    88.             End With 'LabelAxis
    89.             '************** Add Series 1 to region 1 *******************************
    90.             .AddBarSeries
    91.             With .BarSeries(1)
    92.                 .SeriesType = RMC_BARSINGLE
    93.                 .SeriesStyle = RMC_BAR_FLAT_GRADIENT2
    94.                 .Lucent = False
    95.                 .Color = CornflowerBlue
    96.                 .Horizontal = False
    97.                 .WhichDataAxis = 1
    98.                 .ValueLabelOn = False
    99.                 .PointsPerColumn = 1
    100.                 .HatchMode = RMC_HATCHBRUSH_OFF
    101.                 '****** Set data values ******
    102.                 sTemp = "50*70*40*60*30"
    103.                 .DataString = sTemp
    104.                
    105.                 .SetColorValue 3, Red      ' Set the color for the third bar to Red
    106.                
    107.             End With 'BarSeries(1)
    108.         End With 'Region(1)
    109.         nRetval = .Draw
    110.     End With 'RMChartX1
    111. End Sub

  25. #25

    Thread Starter
    Lively Member
    Join Date
    Jan 2008
    Location
    Netherlands
    Posts
    105

    Re: auto resize RMchart when resizing form

    When i resize my form the chart doesn't change. Can you explain how i can use data from a textfile for my chart?

  26. #26
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: auto resize RMchart when resizing form

    I dont think his resize code is correct.

    Try my resize code from post #20
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  27. #27

    Thread Starter
    Lively Member
    Join Date
    Jan 2008
    Location
    Netherlands
    Posts
    105

    Re: auto resize RMchart when resizing form

    Lintz is using rmchart and you're code is for mschart.
    Is there no guide on the internet which can help me to create a chart from data in a text file?

  28. #28
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: auto resize RMchart when resizing form

    Oh I thought you had switched as you were requesting info on the control (post #19).

    Well decide which control you are going to use and goole it for tutorials. RMChart should have at least something on their site for support. Have you even looked there yet?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  29. #29
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Re: auto resize RMchart when resizing form

    Quote Originally Posted by xavier73
    Is there no guide on the internet which can help me to create a chart from data in a text file?
    If your 'C:\Program Files\RMChart\VB6_DLL' folder open the project 'rmchartdemo.vbp' which will show a lot of examples including how to read data from a csv file.

  30. #30

    Thread Starter
    Lively Member
    Join Date
    Jan 2008
    Location
    Netherlands
    Posts
    105

    Re: auto resize RMchart when resizing form

    With the rmcdesigner it is easy to get the data from a text file for a chart. When i want to use the rmchart.dll and make the chart manually i can't find now information about that on the website of rmchart and on the internet. So i will use the chart i have created with the rmcdesigner. This works fine for now.

  31. #31
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Re: auto resize RMchart when resizing form

    Please mark thread as closed if your issue is resolved

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