n7mafia Posted March 14, 2014 Posted March 14, 2014 I have a text field called TYPE with an attached value list with three alphabetical values (A,B,C). I intend to make a pie-chart to display the % of A,B,C; I reckon I should create a calculation field which takes the data from TYPE and calculates the number of times A, B or C appear. How can I do it? Edit: I added a sample DB for clarity and reference, basically the field I want to interact with is: "Autorita" which can be one of three values (Cassazione; Corte d'Appello; Tribunale); in the sampleDB I made 4 records: 3 of which have "Cassazione" in it and one of which has "Tribunale". What I need, on the "Stats" layout is to make a pie-chart that display a pie with 75% of "Cassazione" and 25% of "Tribunale" SampleDB.zip
comment Posted March 14, 2014 Posted March 14, 2014 I intend to make a pie-chart to display the % of A,B,C; I reckon I should create a calculation field which takes the data from TYPE and calculates the number of times A, B or C appear. No, all you need is a summary field, defined as Count of [ TYPE ] (or of any other field that cannot be empty). Then set your chart as follows: Label Data: YourTable::TYPE Value Data: YourTable::sCount (the above summary field) Use Data From: [ Current Found Set ] [v] Show data points for groups of records when sorted Records must be sorted by TYPE for this to work.
n7mafia Posted March 15, 2014 Author Posted March 15, 2014 I created the summary field as per your instructions and I set the piechart as follows: Category Labels -> Pratica Forense::Autorita (Shouldn't I specify the 3 labels in here?) Slice Data -> Pratica Forense::sAutorita [v] Show Legend [v] Show Values on Chart [v] Percentages [v] Actual Values Data Type: Number Format: Percent And all I get is a humongous all-red pie and beneath it, it reads: "Cassazione 56% 100%" I am pretty sure I missed something.
comment Posted March 15, 2014 Posted March 15, 2014 I don't know. Does this (attached) work for you? SimplePieChart.fp7.zip
n7mafia Posted March 16, 2014 Author Posted March 16, 2014 Not really, if I open it I get a pie divided equally in 26 slices of the same size (3.85% each) instead of a correct % representation. Apparently the reccurrent states do not get considered in the same group as they should.
n7mafia Posted March 17, 2014 Author Posted March 17, 2014 Yes, I know, I tried to sort it but it didn't change much on my DB. I'm getting increasingly frustrated, I've always had troubles with pie charts in filemaker, I'm either still missing something terribly obvious in my pie construction or I missed your pointers completely, I'm running out of options. I am not even sure if I should link the layout "Stats" with either the "DataEntry" table records or to create a new record in the stats table? That's what I get anyways:
LaRetta Posted March 17, 2014 Posted March 17, 2014 You really didn't give enough time to receive a response. Please zip and attach your file.
comment Posted March 17, 2014 Posted March 17, 2014 Unfortunately I cannot look at your file. However, I can tell you that a pie chart (or any other chart, for that matter) is just a graphical representation of the data - in this case, summarized data. If you can get a report going, summarizing your records by Type (in a layout of the same table where records with the Type field live), then the chart will practically draw itself.
eos Posted March 17, 2014 Posted March 17, 2014 Some wrong settings that prevented your data from being charted: 1. You need to use an actually existing, non-quoted (!) field name as the slice data source, and … 2. in Data Source, select Found Set as Chart Data (instead of Current Record); this will then allow you to … 3. simply use the Type field as label source, instead of manually having to create a List () of labels
n7mafia Posted March 17, 2014 Author Posted March 17, 2014 Apologies for the confusion but this thing's driving me crazy. I have this database where a field called "TYPE" can have one of three alphabetic values (CSZ, CA, TRB), I need to make a pie-chart which displays the occurences of the "TYPE" field in a neat pie chart; I've been told in another post to make a summary field to count the occurences and to sort it to make it work which I did but I still didn't manage to make the chart work. This is the sampleDB: SampleDB - PieChart.zip
eos Posted March 17, 2014 Posted March 17, 2014 My points in post #10 above weren't of theoretical nature, it's what's actually wrong in your chart setup.
bruceR Posted March 17, 2014 Posted March 17, 2014 Mods as described by EOS. SampleDB - PieChartBFR.fmp12.zip
n7mafia Posted March 19, 2014 Author Posted March 19, 2014 Okay, thanks to you guys I finally managed to get it to work and the graph now displays things properly, I got a couple of follow-up questions though: 1) I wish to add a few other graphs to evaluate different fields with other pie-charts but since I had to order by the TYPE field how can I set it up? I mean, is there a way to tell FM to order by Field1 for Pie-Chart1 and by Field2 for Pie-Chart2 and so on? Maybe, and I am just theorizing, one could write a simple script to tell FM to sort by X when opening layout 1, sort by Y when opening layout 2 and so on? 2) Also, the mandatory sorting to make the pie-chart work on the "Stats" layout messes up things in the other two layouts which should be ordered by something else like for instance the record number, is there any way to avoid that? Edit: By digging this very forum I noticed I posed a similar questions two years ago and I found some interesting pointers, which at that time I was unable to grasp, they look on the right track though, can anyone help me out developing on them? The old thread is this one: http://fmforums.com/forum/topic/85680-find-script-to-get-the-most-profitable-sales/ The last post is by comment and reads like this: Posted 16 August 2012 - 08:41 PM The idea is roughly this: Sort the records by one field, and write the first 10 names/values into variables. Then sort by another field and again write the first 10 records into another pair of variables. Point your charts to draw their data from the variables.
comment Posted March 27, 2014 Posted March 27, 2014 I mean, is there a way to tell FM to order by Field1 for Pie-Chart1 and by Field2 for Pie-Chart2 and so on? Yes, but records cannot be sorted two different (conflicting) ways at the same time. By digging this very forum I noticed I posed a similar questions two years ago and I found some interesting pointers, which at that time I was unable to grasp, they look on the right track though, can anyone help me out developing on them? Perhaps you should ask a more specific question. I would also suggest you do a search for a technique called Fast Summaries, as this could be very useful to you in this context.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now