5 Replies Latest reply on Dec 8, 2015 8:50 PM by jbrown

    creating pie chart


      I have a field named Disposition that contains the values "Admit" or "Discharge". What is the easiest way to create a pie chart to display the percentage in each group?

        • 1. Re: creating pie chart

          The Quick Chart functionality is great for this.


          View the layout in Table view.  Right click on the Disposition column.  Select "Sort Ascending" (or descending if you wish).  Then right click again on the Disposition column.  Select "Chart by Disposition".


          You will see a column chart.  On the top right of the window you can change the chart type to Pie.

          • 2. Re: creating pie chart

            Thanks-that is perfect.


            I'd also like to crate a line chart to show the % admitted over time. Each record has a date and I have a calc field to determine the starting week. I'd like to have the X axis be week start and the Y axis show % admitted. Any suggestions on that one?


            Thanks again for the help-

            • 3. Re: creating pie chart

              Hi.  Need to get a bit of clarification.  If you think of a percentage as a fraction - what is the top number in the fraction representing and what is the bottom number in the fraction representing?


              for example:  . top number could be the number of records with a starting week date of dd/mm/yy and with disposition of "Admit"


              bottom number could be the total number of records? or the total number of records with disposition of "Admit".


              Not quite sure what you are trying to show - more detail would be very helpful.

              • 4. Re: creating pie chart

                Each record is a patient seen in the Emergency Department. Disposition is either Admit or Discharge.

                I want to plot the % of patients admitted over time. So X-axis would be the week start date and Y-axis would be % of total records with a disposition = admit.


                Does that make sense?

                • 5. Re: creating pie chart

                  You can certainly do this. You can use ExecuteSQL to find the percent of the total users.


                  Whenever I create a chart, I base it off a summary table. In your case, I'd create a "Summary_PercentAdmit" table that has three fields: WeekStart, TotalPatients, PercentAdmit. Then, I'd set a script to calculate the percent of each week's admits at the end of the week (A server-side script that only runs on Fridays or Saturdays) and creates a new record in this Summary_ table.  The reason I do this is because there is a possibility (however slight) that a week could have zero admits. This is a key in building a list of numbers that will be used in the data series. You can't skip a week. All data in the X and Y axes have to be perfectly aligned.

                  Check out the demo I attached. I just filled in random numbers. But my script would populate this table with a new record at the end of every week.


                  I choose a summary table because I don't want ExecuteSQL to have to do the calculating for me. That can slow down the rendering of the chart. I prefer to let a script handle the calculations, store the numbers in static fields, and use those numbers in the fields to display on the chart.