10 Replies Latest reply on Jan 24, 2017 3:48 PM by user19752

    Pie chart not working as expected

    paulsondervan

      I'm trying to create a pie chart.

      The data for the pie chart consists of 1 record with 2 fields.

      These 2 fields (total patients (109) and patients reviewed (40)) should create the pie chart.

       

      I use this for the calculation in Slice data:

      Let(

      [

      ~QryRes = ExecuteSQL ("SELECT GecorrigeerdePatienten, TotaalAfspraken

      FROM Artsen

      WHERE Arts_Code = ?" ; "¶" ; "" ; Dashboard::Arts01 );

      ~PieVal1 = GetValue ( ~QryRes; 1);

      ~PieVal2 = GetValue ( ~QryRes; 2);

      ~RetVal = List(~PieVal1;~PieVal2)

      ];

      ~RetVal

      )

       

      The result is this:

      PiechartProblem.png

      As you can see the 109 for total patients and 40 for the patients reviewed are found, but the data is seen as one big value and not as 2 separate values.

      What am I doing wrong?

        • 1. Re: Pie chart not working as expected
          user19752

          If you use the calculation for field, the result may be number, it should be text.

           

          You can use SQL result itself, not need to GetValue and List.

          • 2. Re: Pie chart not working as expected
            philmodjunk

            does your data source option specify delimited data?

             

            And the last part of your let function does nothing to change the results. The values returned by your query are already in a list, so extract the two values and then putting them back in a list doesn't change the results unless there are more than two values returned by your query.

             

            If there are more than two values and you only want the first two, use FETCH FIRST N ROWS instead.

            • 3. Re: Pie chart not working as expected
              paulsondervan

              user19752 wrote:

               

              If you use the calculation for field, the result may be number, it should be text.

              According to the Calculation window, the result must be Number.

              PieCalculation.png

               

              user19752 wrote:

               

              You can use SQL result itself, not need to GetValue and List.

              That's what I tried first, but the result was the same.

              • 4. Re: Pie chart not working as expected
                paulsondervan

                philmodjunk wrote:

                 

                does your data source option specify delimited data?

                I specified the Newline (¶) as delimiter in the ExecuteSQL.

                 

                philmodjunk wrote:

                 

                If there are more than two values and you only want the first two, use FETCH FIRST N ROWS instead.

                No there are only 2 fields in the query and the result is always only 1 record.

                 

                philmodjunk wrote:

                 

                The values returned by your query are already in a list, so extract the two values and then putting them back in a list doesn't change the results unless there are more than two values returned by your query.

                That's what I thought too, but whatever I do the result is always seen as 1 result field 10940 instead of 140 and 90.

                • 5. Re: Pie chart not working as expected
                  philmodjunk

                  You misunderstood something that I posted. Your chart can specify different data source options. One such option is labeled "delimited data". Have you selected that option?

                   

                  And what values do you specify for the x-series in order to label your slices?

                   

                  You will get the same chart results whether you use just the query results or do the further calculations that you show because they produce exactly the same two values.

                  1 of 1 people found this helpful
                  • 6. Re: Pie chart not working as expected
                    paulsondervan

                    I'm ashamed.

                    The Category labels weren't defined.

                    After I had added these labels, the Pie chart showed up as should.

                    PieChartWorking.png

                     

                    I don't like the text labels beside the Pie chart.

                    Is there a way to hide these text labels beside the Pie chart and have the text labels only in the Legend?

                    • 7. Re: Pie chart not working as expected
                      philmodjunk

                      I don't like the text labels beside the Pie chart.

                      Is there a way to hide these text labels beside the Pie chart and have the text labels only in the Legend?

                      Not with a FileMaker Chart Object. FileMaker Chart Objects are pretty simple to use, but they have distinct limitations.

                       

                      There are other ways to chart data that you can explore if you feel this shortcoming is worth the extra effort to make it worth your time.

                       

                      You can chart with plug ins that offer more options than a FileMaker Chart object.

                       

                      You can use a web viewer and Java Script to chart data in a web viewer.

                      • 8. Re: Pie chart not working as expected
                        user19752

                        Is there a way to hide these text labels beside the Pie chart and have the text labels only in the Legend?

                        Unchecking "Show values on chart" hide them, but also values

                        I wonder why I can select "actual value", "percentage", "both", but always with label.

                        • 9. Re: Pie chart not working as expected
                          paulsondervan

                          paulsondervan wrote:

                           

                          I don't like the text labels beside the Pie chart.

                          Is there a way to hide these text labels beside the Pie chart and have the text labels only in the Legend?

                          I decided to change the label text to " " and created my own legenda.

                          Dashboard.png

                          1 of 1 people found this helpful