How to set each category in pivot in increasing order

DataGraph Forums Technical Support Support Desk How to set each category in pivot in increasing order

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #7212
    panyuz
    Participant

      data

       

      截屏2021-09-10 下午10.35.16

      #7215
      dgteam
      Moderator

        This is. not a built-in feature but we made a template that can produce sorted groups in a bar graph.  We made up some similar data to test and just uploaded to the On-line Example files.  Does this help?

        Bars in Order

        #7216
        panyuz
        Participant

          I understand that the scaled column scales the value to [2000,2004] (honestly, why can the alphabetic column be added directly to the numeric column?

          But the xloc column expression: group-.5+(1+mod(rank-1,N))/(N+1); I just can’t understand it.

          I’ve been using datagraph for 3 years, and most simple graphs can be handled very well. But DG is like a treasure, there are too many possibilities still waiting to be discovered. But the graphing logic of DG and the many parameters are confusing. Can the developers write some articles about the aesthetic logic of DG as a whole, just like ggplot2

          #7217
          dgteam
          Moderator

            The Text column does not have a lot of options, but the one option it does have is to map to numerical values.  When you set the “Values” option you can use the Text column just like a number column.  Click the display button to the right of the Values menu to confirm how the column has been mapped.

            num

            For now, we edited the example file such that ‘group’ is a number column, so it does not rely on this mapping. We also included a separate graph that uses labels on the axis, like a standard bar graph, and one that use the numerical value.  Now, you should be able to paste your data into the template whether the columns are numbers or text.

            We also modified the file to break down the equations and show the intermediate steps, so hopefully it will be more understandable.  Here is how we broke the equations down where you have M groups along the x axis and N categories within the groups. The general expression for the location of each bar on the X axis as follows.

            locX = group + shift

            Where

            shift = – 0.5 +(1+order)/(N+1)

            group = The sequential order of the column groups, from 1 to M.

            order = The rank within a group, from 1, N.

            The trick here is how do you know the order? What we did was derive the order from the overall rank using a mod function, such that

            order = mod(rank-1,N)

            where

            rank = The overall rank order across all the bars, from 1, MxN.

            This is the order that the bars will have from left to right along the x-axis of the final graph.

            Finally, here is an article to explain the difference between Bar, Bars and Pivot commands.

            How to make a Bar Graph

            Does this help?

             

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

          DataGraph Forums Technical Support Support Desk How to set each category in pivot in increasing order