Stacked Bar graphs does not seem to be working

DataGraph Forums Technical Support Support Desk Stacked Bar graphs does not seem to be working

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #4658
    uma bhatt
    Participant

      I am trying to make a stacked bar graphs with 3 different columns of data. If I plot 2 columns (fig 1) then the stacked bar charts look fine but once I add the third value (fig 2) then the third color (green in this case) appears to take over the stack (e.g., 1979, 1994, 1995,2006).  I am really not sure what I am doing wrong. Thanks, Uma

      JuneJuly-stackJJA-stack

      #4661
      dgteam
      Moderator

        Hi Uma — Plotting negative values in bar graphs can be tricky!

        The stacked bar will end at the sum of the values, in the positive direction.

        When the data have a negative followed by a positive number, DataGraph stacks the bars in order, such that bars are drawn down and then up again.  This is also happening in the case of the two bars but it may not be as obvious.

        Here is an example to illustrate.  Here is the data:

        ExampleData

        If it is graphed using a Bars command, it will look like this.

        Stacked01

        Note that I made the blue and the grey at 50% opacity so you can see through them.

        Here is the stacked version, with arrows are added to illustrate the stacking of the negative and positive values.

        Stacked02

        Notice how the graph preserves the total.  The value of the bar in the positive direction is the same as the total of each (A = 3, C = 4).  The bar at ‘C’ is green in the negative because the yellow and blue are ‘combined’ due to the transparency of the blue.

        To have the negative and positive values stacked separately, an Expression column can be used to create a column of each.

        PullData

        The positive and negative values plotted using separate Bars commands.

        Stacked03

         

        The caution here is that the values may look inflated.  For example, column C looks like it has a value of 8, but the total  is 4.

        Hopefully this explains what you are seeing and how to create the separately stacked option, if that is what you prefer.

         

        #4662
        uma bhatt
        Participant

          A big thanks for the quick response. I figured it had to do with the negative values and your easy-to-follow  solutions solved my problem. Now I just have to figure out how to get the legend to not show both the positive and negative part of the bar!  Uma

          #4663
          dgteam
          Moderator

            No problem!

            The Legend command entries for the Bars command are set in a field called Legend. By default, this field contains tokens (those blue bars) that are linked to the name of the column.

            To customize, delete the token and enter text directly.  Leave the entry box blank to remove a column from the legend.

            Legend-Names

            You can also create a Custom Legend, which is what I had done for the graphs in the last post, but the above approach is probably easier for this instance.

             

            #4664
            uma bhatt
            Participant

              Thanks for this legend example. I got the custom working but this one had a black border around my color box and looked better. I am set! Thanks for your help! Uma

            Viewing 5 posts - 1 through 5 (of 5 total)
            • You must be logged in to reply to this topic.

            DataGraph Forums Technical Support Support Desk Stacked Bar graphs does not seem to be working