Column Name variable

DataGraph Forums Technical Support Support Desk Column Name variable

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #6256
    david blackwell
    Participant

      Is it possible to create a “column name” variable? For example, I publish charts of U.S. state-based COVID data gathered from public sources. For a specific variable, say New COVID Cases, I plot the daily new cases of COVID for each state and often compare it to data from the other 50 states and D.C., de-emphasized and in the background.

      I generate a separate chart for each state and publish each individually or aggregate them in a single Datagraph canvas chart and publish it as one larger collector graphic.

      I plot all of these charts on a common x-axis timeline. All of the chart background elements, including axis titles, chart titles, axis scales, footers, and legends can be controlled in all 51 charts simultaneously by changing the associated variables I create for them with a simple update to the value.
      However, I cannot change the y-axis data value I am plotting against without updating each individual state chart.

      I have not been able to determine whether a column to plot value can be controlled via a variable setting. If it can be, this would greatly simplify my updates.

      I’ve included a screen sho of a sample Datagraph file, including the individual state chart thumbnails. Specific to the question I am asking, I’m trying to see if I can update the values shown in 1A and 1B via a variable. Is there a method to change the column from, say “New COVID Cases” to “New COVID Tests” easily and have all 51 charts update at the same time?

      datagraphForumQuestion-01

      #6258
      david
      Moderator

        One option is to use the Redirect column.  So set a “Y to use” column as a redirect column and use that instead of the New COVID Cases in your drawing commands. Then you can change which “Y to use” points to.

        If all that is changing in the graphs is the state/DC and you want to export all of them into files you can use the Text Menu to specify the State names, use that variable in the mask and then use the gear menu for the text menu to export all the images.  It will loop through all of the entries in the menu, and create the graph based on that selection.  This variable can be used in the mask, titles etc.SimpleMenu

        #6261
        david blackwell
        Participant

          david (Moderator):

          Oh wow, that works like a charm! Thanks so much for those tips. Last summer and autumn I was publishing up to 550 charts several times per week. Early on, it was taking me 2-3 hours to manage the changes.

          I was able to get it down to updating 10 or so unique dgraph files, one for each unique series of 51 charts plus a few extra charts. And my ‘daily’ updates took a little less than an hour.

          It would’ve been so much easier to use the methods you just explained. Many thanks again!

           

          David Blackwell
          Seattle

          #6262
          petercreate
          Participant

            Hi David,

            What you show here may be very useful. Would you please give further description on your work, especially on the column variables part?

            Cheers,

            Peter

            #6263
            david blackwell
            Participant

              Peter,

              A Datagraph moderator named David gave me the correct solution to my question. It is quite easy to set up and implement. He gave good directions, but I’ll elaborate here with screen shots of my own datagraph file.

              Setting the Table
              I download COVID data for all 50 U.S. states and the District of Columbia from John Hopkins University in the form of a large .csv file. I import this file into my master COVID Datagraph file directly and as-is.

              I have a minimum of six (6) sets of state-level data I like to develop charts for and publish. These include:

              • Cumulative COVID Testing by State
              • Daily COVID Testing by State
              • Cumulative COVID Cases by State
              • Daily COVID Cases by State
              • Cumulative Positivity by State
              • Daily Positivity by State

              In the past, the way I had my Datagraph file set up meant I had (306) charts to update and publish. I found ways to minimize this to updating six sets of charts most days through the use of title, text and axis variables.

              However, if there was a change in the data structure (e.g. the underlying .csv file) or to the design of a chart, I was required to update multiple elements in all (51) charts for each set of data. Both happened frequently, especially early on in this data project. It was very tedious to update these with the way I originally set up my datagraph file.

              1. The y-column Variable Solution
              An administrator from Datagraph named David really simplified my process by offering two key bits of advice.

              The first was to create a “Redirect” column. This is located in the top menu bar of the Column Definitions menu under the “Other” drop-down menu. Selecting this, you see there is a Redirect-type column (A). It appears in the list of column definitions below (B). You also see it in the table of data (C).

              In the column definition section, you can select which column to redirect data from (B1). This is how you can set up a ‘master’ chart and with a y-value variable.

              RedirectGraphic-01

               

              2. Publishing Graphics via a Loop Mechanism

              The second piece of advice David gave me was equally useful, maybe even a little more. My former Datagraph file contained a separate chart for each state. Now I can publish a unique graphic for each state from a single master chart.

              The first step is to build a text variable menu (D). After typing in the first two-letter state postal code abbreviation for Alaska (AK), you have the option to populate the remaining names by clicking on the gear wheel of this new variable and selecting “Add unique values (the column) state”.

              Steps E1 and E2 shown in the graphic set up the variable masks for the red state data line and the state red text element in the chart.

              Once D, E1 and E2 are finished, Step F shows how to publish all 51 charts in a single click.

              publish51

               

              I hope this helps.

              David B.

              #6264
              david blackwell
              Participant

                Peter,

                One more thing. Here is a link to a 51-chart sample page I published with some basic stats on published file sizes and upload times using the methods described above.

                https://www.litterrocks.com/upload-state-charts-test

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

              DataGraph Forums Technical Support Support Desk Column Name variable