No announcement yet.

gbChartMaster - Discussion

  • Filter
  • Time
  • Show
Clear All
new posts

  • gbChartMaster - Discussion

    This page is for discussion of my latest posted application, gbChartMaster, which generates a variety of charts - bar charts (2D and 3D), stacked bar charts, line charts, multi-line charts, points/symbols only and a hi-lo bar chart. Control over all aspects of the graph elements - position, color, fonts, margins, grid, and more - is provided. Images for background and for annotation stamps are also supported.

    While chart data is typically provided point by point by the user, gbChartMaster also allows the user to supply an equation which can be used to automatically generate the graph data.

    The chart source code is written so that it can be easily inserted into PowerBASIC applications, so that other programmers can add the graphing capabilities to their own applications. The gbChartMaster application is essentially a demonstration of how to use the include source code in a PowerBASIC application, including how to use all 100+ available settings!

    As always, comments and suggestions are welcome!
    Last edited by Gary Beene; 27 Jul 2015, 02:02 PM.

  • #2
    Some images of sample charts:


    • #3
      Online Help has a section on how to add the charting features to your own PowerBASIC app. But, here's a minimal code example, which includes the following steps:

      1. Create two variables - D() as ChartData and B as ChartSettings.
      2. Create Graphic control
      3. Create some data to graph
      4. Initialize the two variables
      5. Resize the Graphic control as needed.

      The code below gets you this (no image support):

      'Compilable Example:
      #Compiler PBWin 10
      #Compile Exe
      #Dim All
      %Unicode = 1
      #Include ""
      #Include ""
      Enum Equates Singular
         IDC_Graphic = 500
      End Enum
      Global hDlg,hGraphic As Dword
      Global D() As ChartData, B As ChartSettings
      Function PBMain() As Long
         Dialog New Pixels, 0, "PowerBASIC",300,300,600,300, %WS_OverlappedWindow To hDlg
         Control Add Graphic, hDlg, %IDC_Graphic,"Push", 0,0,600,300, %SS_Notify
         Control Handle hDlg, %IDC_Graphic To hGraphic
         Graphic Attach hDlg, %IDC_Graphic, ReDraw
         Dialog Show Modal hDlg Call DlgProc
      End Function
      CallBack Function DlgProc() As Long
         Local w,h As Long
         Select Case Cb.Msg
            Case %WM_InitDialog
               InitializeChart hDlg, %IDC_Graphic
               B.Xmax = 60 : B.Xmin = 10 : B.Pivot = 40
            Case %WM_Size
               Dialog Get Client hDlg To w,h
               Control Set Size hDlg, %IDC_Graphic, w,h
               DrawChart D(), B, %True
         End Select
      End Function
      Sub CreateFakeData         'this is a user function
         Local i As Long
         ReDim D(1 To 100)
         For i = 1 To 40  : D(i).v(1) = 100 * (1.05)^i : Next i
         For i = 41 To 60 : D(i).v(1) = D(40).v(1) - 600 * (1.2)^(i-60)  : Next i
         For i = 1 To 60
            D(i).altColor(1) = %Gray : D(i).altColor(2) = %Gray : D(i).altColor(3) = %Gray
            D(i).v(2) = D(i).v(1) - 150 * Rnd
            D(i).v(3) = D(i).v(1) + 150 * Rnd
            D(i).altText(1)  = "Bar" + LTrim$(Str$(i)) + "_1"  'Chr$(Rnd(97,122)) + Chr$(Rnd(97,122)) + Chr$(Rnd(97,122)) + Chr$(Rnd(97,122)) + Chr$(Rnd(97,122))
            D(i).altText(2)  = "Bar" + LTrim$(Str$(i)) + "_2"  'Chr$(Rnd(97,122)) + Chr$(Rnd(97,122)) + Chr$(Rnd(97,122)) + Chr$(Rnd(97,122)) + Chr$(Rnd(97,122))
            D(i).altText(3)  = "Bar" + LTrim$(Str$(i)) + "_3"  'Chr$(Rnd(97,122)) + Chr$(Rnd(97,122)) + Chr$(Rnd(97,122)) + Chr$(Rnd(97,122)) + Chr$(Rnd(97,122))
            D(i).barlabel(1) = "Label" + LTrim$(Str$(i)) + "_1" 'Chr$(Rnd(97,122)) + Chr$(Rnd(97,122)) + Chr$(Rnd(97,122)) + Chr$(Rnd(97,122)) + Chr$(Rnd(97,122)) + Chr$(Rnd(97,122)) + Chr$(Rnd(97,122)) + Chr$(Rnd(97,122))
            D(i).barlabel(2) = "Label" + LTrim$(Str$(i)) + "_2" 'Chr$(Rnd(97,122)) + Chr$(Rnd(97,122)) + Chr$(Rnd(97,122)) + Chr$(Rnd(97,122)) + Chr$(Rnd(97,122)) + Chr$(Rnd(97,122)) + Chr$(Rnd(97,122)) + Chr$(Rnd(97,122))
            D(i).barlabel(3) = "Label" + LTrim$(Str$(i)) + "_3" 'Chr$(Rnd(97,122)) + Chr$(Rnd(97,122)) + Chr$(Rnd(97,122)) + Chr$(Rnd(97,122)) + Chr$(Rnd(97,122)) + Chr$(Rnd(97,122)) + Chr$(Rnd(97,122)) + Chr$(Rnd(97,122))
         Next i
         For i = 1 To 60
            If D(i).v(1) < 0 Then D(i).v(1) = 0
            If D(i).v(2) < 0 Then D(i).v(2) = 0
            If D(i).v(3) < 0 Then D(i).v(3) = 0
         Next i
      End Sub
      Sub InitializeChart(hWnd As Dword, cID As Long)    'this a user function for assigning Chart settings
         B.hParent       = hWnd
         B.cID           = cID
         Control Handle B.hParent, B.cID To B.hGraphic
         Graphic Get DC To B.hGraphicDC
         B.LM            = 100
         B.RM            = 80
         B.TM            = 60
         B.BM            = 40
         B.Title         = "gbChartMaster"
         B.XTitle        = "X-Value:"
         B.YTitle        = "Y-Value:"
         B.DataSetTitle(1) = "Title 1"
         B.DataSetTitle(2) = "Title 2"
         B.DataSetTitle(3) = "Title 3"
         B.DivYCount     = 5
         B.Xmax          = UBound(D)
         B.XMin          = 1
         B.maxYValue     = 0
         B.usefixedYvalue= 0
         B.fixedYvalue   = 10000    '1=10 2=100 3=1000 ...
         B.coverage      = 0.6 '>0.1 and <=1.0
         B.Pivot         = UBound(D)
         B.FadeValue     = 0
         B.AllBars       = 1
         B.ShowGrid      = 1
         B.ShowTitle     = 1
         B.ShowAxisTitles = 1
         B.ShowAxisValues = 1
         B.HoverTips     = 1
         B.UserData(1)   = "10" + $CrLf    + "40" + $CrLf    + "90" + $CrLf    + "160" + $CrLf     + "120"
         B.AltText(1)    = "One" + $CrLf   + "Four" + $CrLf  + "Nine" + $CrLf  + "Twenty" + $CrLf  + "Twelve"
         B.BarLabels(1)  = "Plum" + $CrLf  + "Peach" + $CrLf + "Pear" + $CrLf  + "Apple" + $CrLf   + "Orange"
         B.UserData(2)   = "8" + $CrLf     + "32" + $CrLf    + "70" + $CrLf    + "120" + $CrLf     + "115"
         B.AltText(2)    = "Left" + $CrLf  + "Right" + $CrLf + "Top" + $CrLf   + "Bottom" + $CrLf  + "Center"
         B.BarLabels(2)  = "Oak" + $CrLf   + "Elm" + $CrLf   + "Birch" + $CrLf + "Redwood" + $CrLf + "Magnolia"
         B.UserData(3)   = "14" + $CrLf    + "43" + $CrLf    + "120" + $CrLf   + "175" + $CrLf     + "132"
         B.AltText(3)    = "North" + $CrLf + "South" + $CrLf + "East" + $CrLf  + "West" + $CrLf    + "None"
         B.BarLabels(3)  = "Pigs" + $CrLf  + "Cows" + $CrLf  + "Sheep" + $CrLf + "Horses" + $CrLf  + "Goats"
         B.GraphType     = 1        '1=2D 2=3D 3=Line 4=DOT
         B.BarGradientType  = 1        '1=flat
         B.ThreeDX       = 15
         B.ThreeDY       = 20
         B.titleFontName = "Tahoma"
         B.titleFontSize = 14
         B.titleFontBold = 1
         B.axisTitleFontName = "Tahoma"
         B.axisTitleFontSize = 10
         B.axisTitleFontBold = 1
         B.DataSet           = 1
         B.axisValueFontName = "Tahoma"
         B.axisValueFontSize = 10
         B.axisValueFontBold = 0
         B.useAltColors   = 0
         B.useAltText     = 0
         B.gradientBG     = 0
         B.fadeBG         = 0
         B.cBG           = %White
         B.cTitle        = %Black
         B.cAxisLines    = %Black
         B.cAxisValues   = %Black
         B.cPreBars(1)   = %Green
         B.cPreBars(2)   = %rgb_DarkGreen
         B.cPreBars(3)   = %rgb_LightGreen
         B.cPostBars(1)  = %Red
         B.cPostBars(2)  = %rgb_DarkRed
         B.cPostBars(3)  = %rgb_Salmon
         B.cSymbols(1)   = %rgb_DarkGray
         B.cSymbols(2)   = %Gray
         B.cSymbols(3)   = %rgb_LightGray
         B.BarBorder     = 2       '1=none 2=black 3=white
         B.ShowBarLabel  = 0
         B.VertBarLabels = 0
         B.Annotation    = 0
         B.LargeStamp    = 1
         B.RoundedBar    = 0
         B.MinusYAxis    = 0
         B.VertYLabel    = 0
         B.SoftGrid      = 0
         B.LeftTitle     = 0       '0=mid 1=left
         B.LeftXTitle    = 1       '0=left 1=mid
         B.TopYTitle     = 1
         B.AutoXCount    = 1
         B.ExportFormat  = 2       '1=bmp 2=jpg 3=gif 4=png
         B.Equation(1)   = "1:100:0:0.3:20+10 * sin(x)"
         B.Equation(2)   = "1:100:0:1:100*x + 70"
         B.Equation(3)   = "1:100:0:0.3:20+10 * ABS(sin(x))"
         B.EquationAnimate = 0
      '   B.StampList     = ""
      '   B.Stamp         = Exe.Path$ + "stamps\" + Dir$(Exe.Path$ + "stamps\_markerblue.png")
      '   If IsFalse IsFile(B.Stamp) Then B.Stamp = Exe.Path$ + "stamps\" + Dir$(Exe.Path$ + "stamps\*.*")
         B.ShowBGImage   = 0
      '   B.BGImage       = Exe.Path$ + "bgimages\eyes.jpg"
      '   If IsFalse IsFile(B.BGImage) Then B.BGImage = Exe.Path$ + "bgimages\" + Dir$(Exe.Path$ + "bgimages\*.*")
      '   LoadBGImage ((B.BGImage), B.hBGImage)  'Graphic Bitmap Load B.BGimage, 0, 0 To B.hBGImage
         B.BGImageFit    = 1       '0-no resize 1=resize to fit
         B.LineSymbol    = 2       '1-dot 1=circle 2=triangle 3=square 4=emptydot
         B.LineThickness = 1
         B.SymbolSize    = 1
         B.Interval      = 100     'milliseconds
      End Sub
      Sub CreateFonts
         'set Graphic to default font to free up other fonts for deletion
         Graphic Set Font 0
         'delete other fonts
         Font End B.TitleFont
         Font End B.axisTitleFont
         Font End B.axisTitleFontR
         Font End B.axisValueFont
         Font End B.axisValueFontR
         'rebuild fonts
         Font New B.TitleFontName,     B.TitleFontSize,     B.TitleFontBold     To B.TitleFont
         Font New B.axisTitleFontName, B.axisTitleFontSize, B.axisTitleFontBold To B.axisTitleFont
         Font New B.axisTitleFontName, B.axisTitleFontSize, B.axisTitleFontBold,1,0, 900 To B.axisTitleFontR
         Font New B.axisValueFontName, B.axisValueFontSize, B.axisValueFontBold To B.axisValueFont
         Font New B.axisValueFontName, B.axisValueFontSize, B.axisValueFontBold,1,0, 900 To B.axisValueFontR
      End Sub


      • #4
        In gbChartMaster (the application) I provide support for images using code from Jose's include files.

        If you don't need image support, you can remove the image functions and the remainder of the code should compile just fine using PowerBASIC include files.


        • #5
          Yesterday, Larry Charlton sent me a PM with some really good suggestions for gbChartMaster. He said I could post his comments ...

          Looks like you're having fun!

          If you're looking for some feedback / ideas here's a few.

          When I adjusted the top margin (TM is top margin?) the title didn't quite adjust appropriately. At 40 and 30 while there was plenty of room for the title, it merged into the graph.

          The Horizontal Y-Value seems like it could be a bit higher as well, at smaller margins it was over-writing the graph. It also seemed as though it should right align with the numbers for the Y values when display horizontally.

          Be nice if the vertical Y label has Top, Center, Bottom alignment option.

          Be nice if the X label alignment had something like left inline, left, center, right, right inline.

          Stamps were cool, but it would have been nice to be able to drag and/or resize them.

          Annotation might be partially implemented or mis-labeled. At least the way I read it, annotation is the comment often associated with graphical markers of some form (circles, highlights, etc). I think you're calling the graphical markers annotations. Unless you're thought was using the mouse to write a note.

          Might be nice to label Chart, Axis, Values area as a Font change. Thought the feature was missing for a while.

          Alignment is often Left, Center, Right for horizontal

          There was an option for horizontal lines but not vertical lines.

          The background image stretches like rubber. Might be nice to add the option of Stretch, Fill, or Fit. where fill and fit preserve x/y ratios and fill uses the smallest of width/height to size and Fit uses the largest.

          On the rounded bar, how about either a # of pixels or % of width option for rounding. You could do something like <0 = % >0 = pixels so 3 would be a 3 pixel rounding, -50 would be a fully round top.

          You have a softGrid option, how about a grid color option?

          From an ease of use standpoint, it would be nice if the left, right, top, and bottom margins adjusted based on features used. (i.e. have a title, make room for it).

          I set the line thickness to 19 and did not note any change (I was viewing bars). It might be nice if you only saw features that applied to the graph you're working on or if features unrelated were disabled.

          You have an Export feature... How about an Export PB Code feature? I.e. the code it would take to create a graph with the features provided.

          Alternatively... How about a save/load settings feature built into the .inc file that allows loading or saving the settings to/from a disk file.


          • #6
            Hey Larry!
            Thanks for taking the time to give gbChartMaster a try! Here's what I've done so far - should have a new version out later tonight.

   settings option

            ...say "Font" in settings dialog

            ...grid color to replace soft grid

            ...vertical grid lines
            Done. I also added a display of the margins, option to used dotted lines on grid lines.

            Done. Now has LeftInline, Left, Center, Right, RightInline positions.

            Done. Now has Top, Center, Bottom positions

            ... Have a title, make room for it
            Done. Margins are now adjusted according to size/orientation/location of titles. You can make the margins bigger than the minimum needed to display the titles at the current font, but not smaller.

            While I was there, I added visual options on the HiLo Bar chart ...


            • #7
              But Larry,
              I didn't make all of the suggestions happen. Some comments ...

              ...stamp drag/resize
              While that is a good idea, and I did implement it in my gbAnnotate application, I wasn't planning on doing much more in the way of annotation features with gbChartMaster. I will, however, go take a look at gbAnnotate and see if I can import some of the code - such as stamp objects (move/resize) and adding text to balloons. Exporting the chart image to gbAnnotate would get the job done, but would not save the results in a gbChartMaster file.

              ...BG Stretch
              gbChartMaster already has the option to size the application to fit the aspect ratio of the background image. I'd thought of resizing the BG image to fit within the current app client size as you suggest, but that would leave "empty" background around the edges of the graph and I'm not sure I like that look.

              ...export code to create graph
              I like this idea! I'm not at all sure how to do it just yet. But I'll think on it some more. If the code was all in a single function, it would be easy to just do a Replace of variables with the correct values. But with the code spread out across many locations, I'm not sure yet how to implement the idea. But I will think on it some more!

              ...rounded bar
              The Graphic Box only has 1 argument that lets me round the box, and that rounds the top and bottom of the box - meaning that my bars would look funny. I'd have to come up with a replacement function for Graphic Box to meet your suggestion. I can probably do that, just haven't tried yet.

              ...disable unavailable controls on Settings dialog
              Ouch! That is, of course, a good idea. But with 100+ controls to manage, where tens of settings might change which controls should be active, I may be too lazy to act on this suggestion.


              • #8
                gbChartMaster v1.1 is now available for download.

                Primary New Features:
                • Main Title positions increased to Left, Center Right
                • XTitle positions increased to InlineLeft, Left, Center, Right, InlineRight
                • YTitle positions increased to Top, Center, Bottom
                • Margins automatically changed to accommodate title position and font size changes
                • Save/Open settings (separate from saving charts)
                • Anti-Aliasing for Line/2Line/3Line graphs (only for line width = 1)
                • Rounded bars (10 different settings)
                • Ctrl-M display margins
                • Vertical Grid
                • Grid Color (used to be 'SoftGrid' only)
                • Dotted Grid option
                • Bar labels change position when symbol size is changed (line charts)
                • HiLo formats added - Bar, Beam, Beam+Symbol
                • Optional speed test (time to draw a graph)
                • Added current chart type to Statusbar

                Other Changes:
                • Settings Dialog reorganized/resized
                • Font added to buttons in Settings Dialog
                • Default BM changed. 40 -> 50
                • Default LM changed. 100 -> 110
                • Default UserData\Alt Text\Bar Labels all changed
                • List of possible LM\TM\BM\RM values doubled
                • Help image added to online Help button
                • Equates added to code to replace hard-coded values

                I've not yet updated the Online Help, but all of the changes should be easy to understand by looking at the Settings Dialog. I"ll update Online Help tomorrow.

                My thanks to Larry Charlton who suggested many of the changes! A few items he suggested, that I've not done but do have on my list, include:
                1. Stamp Resize and Drag-to-Move
                2. Additional options on background image stretching
                3. Export PowerBASIC code to create a graph
                4. Disable unavailable controls on Settings dialog

                As always, if anyone find a problem or has suggestions for further improvements, please speak up! Especially with as many changes as I made this time, I'm definitely interested in whether any of the changes did get implemented correctly, or whether they might have caused unexpected effects!
                Last edited by Gary Beene; 2 Aug 2015, 11:04 PM.


                • #9
                  Hi Gary,

                  Thank you very much for this excellent new piece of software.

                  I'm looking to replace RMChart in my PB projects. More specifically I'm curious to know if I can generate this kind of bar charts with gbChartMaster:

                  1. Horizontal bars (vertical bars is already available).
                  2. Bar labels are replaced by the value of the bar.
                  3. Axis values are replaced by labels
                  4. Random colors for the bars

                  NB: you will find enclosed two examples made with RMChart that I would like to replace with gbChartMaster.

                  Attached Files
                  Jean-Pierre LEROY


                  • #10
                    Hi Jean-Pierre!
                    Glad to hear of your interest in gbChartMaster. I've enjoyed writing it and hope to make further improvements on it.

                    The Horizontal Bars and Bar Labels = Value are not currently available.

                    gbChartMaster already has the ability to independently see the color of each bar.

                    gbChartMaster already has the ability to replace the Axis value with the .alttxt property (See "Alt Text" in the Settings dialog).

                    I'll take a look at adding the horizontal bars, as well as allowing the Bar Labels to be replaced with the value. The 1st is harder, the 2nd is easier.


                    • #11

                      The Bar Labels = Value ... not ... available.
                      Actually, that's misleading. You can, in the parent application, set the Bar Labels to any string you want. So you can have the Bar Label be the bar value.

                      I just don't have a setting that automatically makes that string assignment for you. I'll follow up with such a setting, but it is something you can implement via code in your app.


                      • #12
                        I just loaded a v1.11 that added the option to replace Bar Labels with the value of the Bar.

                        In Stacked Bar charts, I put the sum of the bar values in the stack.

                        In the HiLo Bar chart, I put the upper and lower values of the bar on the chart.

                        Please give it a try and see if it meets your request.


                        • #13
                          Thank Gary for this update.

                          I will do some tests tomorrow and I will keep you informed.

                          Thanks a lot.
                          Last edited by Jean-Pierre LEROY; 3 Aug 2015, 03:34 PM. Reason: typo
                          Jean-Pierre LEROY


                          • #14
                            Hey, Larry!
                            I just today realized I may have mis-interpreted something you suggested ...

                            ...export code to create graph
                            Did you mean to export the settings, as made within gbChartMaster, in the form of a function that a programmer could drop into their app (the initialization function)?

                            Now that's something I can do easily. The programmer works with gbChartMaster to get the look they want, then they export the SUB INITIALIZECHART procedure that will let their app display that one particular chart with all of the settings they have pre-chosen? Their app would then use the include file or a soon-to-be-released DLL.

                            Or, did you really mean to suggest that I export the entire subset of my gbChartMaster PowerBASIC statements (as an include) for the programmer to use?


                            • #15
                              gbChartMaster v2.0 has been released and is ready for download.

                              Some images of the new pie chart features ...

                              Pie charts support provides the largest number of new features:
                              • Pie Charts (up to 3 datasets per chart)
                              • Select section(s) of the chart
                              • Explode pie chart section selections
                              • 2D and 3D charts
                              • Legends
                              • Rotate pie charts
                              • Gradient charts (light center, full color at perimeter)
                              • Circle or ellipse shapes
                              • Hide unselected pie sections
                              • External labels
                              • Internal % labels

                              In addition, other new features have been added:
                              • Font size selection simplified (can scroll to get wanted size)
                              • Onscreen mouse instructions
                              • Onscreen margins
                              • Grid on Top
                              • Line Styles dot/dash
                              • Default pie colors
                              • Smooth lines Bezier
                              • Speed test
                              • Stacked bar labeling improvements

                              Example of line smoothing:

                              A special thanks is owed to everyone who helped out on several threads (3D pie, angle intersection and rectangle rounding) that were related to the pie chart and other new features of gbChartMaster.

                              Michael Boho was especially helpful with his many code examples on a 3D pie. I've still not gotten all of the results of his and my discussions built into gbChartMaster, but I'm working on it!

                              As always, comments and suggestions are welcome!
                              Last edited by Gary Beene; 22 Sep 2015, 12:10 AM.


                              • #16
                                Here's my current gbChartMaster GoDo List:
                                • DLL
                                • Anti-aliasing on more than line charts
                                • OpenGL Version
                                • 3D pie explosion/selection/rotation improvements
                                • Custom line chart symbols
                                • support for -Y axis values

                                Creating a DLL is the primary thing I want to try in the next release. The other items on the list matter, but are secondary to the DLL.


                                • #17
                                  Many, many, many, many thanks Gary for the work you share.

                                  I cannot thank you enough!
                                  Francisco J Castanedo
                                  Software Developer
                                  Distribuidora 3HP, C.A.


                                  • #18
                                    Hello, Francisco!
                                    You're quite welcome!

                                    Please be sure to let me know of any issues that you see.

                                    For example, I know that when I rotate a pie section beyond 360 degrees, that the mouse-over code doesn't correctly show the pie section details in the statusbar. I'm interested in hearing about any and all glitches you see, as well as suggestions for additional features.


                                    • #19
                                      Great work!
                                      When drawing bar charts on the screen it became very obvious that some method had to be incorporated to maintain uniform bar thickness, especially where there were lots of bars. For example, see my "Historical Stock Market Performance" post of November 24th, which takes that into account(also demonstrates log scaling).
                                      In that, and subsequently all bar construction routines I use, I opted to use an algorithm where horizontal resizing would only occur when the overall width had changed exactly the number of vertical bars in the presentation. Without uniform bar thickness, the window presentation does not look very good.
                                      When using a printer with at least 300 dpi resolution, this algorithm is not needed, although I use it anyway because at 300 dpi or more, the impact of this algorithm is minimal, yet preserves the WYSIWYG accuracy versus the window view.

                                      In my experience, some of my users have indicated a preference for pyramids versus pies. This might possibly be another option you could add to your DLL in the future. Attached is a window from one of my programs demonstrating this. Please note that in order to maintain visual accuracy, the pyramid allocations are determined by frontal surface area, NOT the height.
                                      Attached Files
                                      Last edited by Michael Boho; 22 Sep 2015, 11:40 AM. Reason: Clarification
                                      It's impossible to make anything foolproof because fools are so ingenious.


                                      • #20
                                        Hi Micheal!

                                        I like the pyramids. I can't say as I've run across that approach before.

                                        ... method had to be incorporated to maintain uniform bar thickness,
                                        Yes, I have code built in to address that, as well as for hiding X-axis labels when the number of bars is so large that adjacent labels overlap. But even with my code, when the # of bars is very large, the bar widths can vary as you have cautioned. I'll go take a look at your code for use here.

                                        ... resizing would only occur when the overall width had changed exactly the number of vertical bars in the presentation. Without uniform bar thickness, the window presentation does not look very good.
                                        Yes, I did something like that in my earlier code but I thought the "jumping" in size was distracting. I opted for smooth transition over the jumping issue. I'll look for how that works in your example. Thanks for pointing our your posted example.