Alpha Video Training
Results 1 to 26 of 26

Thread: "explode" slice of a pie chart

  1. #1
    Member
    Real Name
    t walker
    Join Date
    Mar 2012
    Location
    USA
    Posts
    230

    Default "explode" slice of a pie chart

    Hello,

    I am trying to figure out what type of expression do you have to create to have a slice of the pie chart moved. I want to explode the slice with the largest amount. I looked at the videos for charts and the help file, but did not see any examples of how to use this feature. Any help would be greatly appreciated.

    Thank you
    Tracy

  2. #2
    Member
    Real Name
    t walker
    Join Date
    Mar 2012
    Location
    USA
    Posts
    230

    Default Re: "explode" slice of a pie chart

    Hello,

    Can anyone confirm that the explode pie chart option works? Has anyone used it?
    Let me know

    Thanks
    Tracy

  3. #3
    "Certified" Alphaholic Keith Hubert's Avatar
    Real Name
    Keith Hubert
    Join Date
    Jul 2000
    Location
    London, UK
    Posts
    6,930

    Default Re: "explode" slice of a pie chart

    Hi Tracy,

    I can confirm the pie chart can be made to explode. Can you post a sample of what you have so far.
    Regards
    Keith Hubert
    Alpha Guild Member
    London.
    KHDB Management Systems
    Skype = keith.hubert


    For your day-to-day Needs, you Need an Alpha Database!

  4. #4
    Member
    Real Name
    t walker
    Join Date
    Mar 2012
    Location
    USA
    Posts
    230

    Default Re: "explode" slice of a pie chart

    Hi Keith,

    That is good to hear that the options works.

    I'm not sure what you are asking me to post. I created a pie chart and want to explode the slice that has the largest value based on the value displayed from the "Data" field on the Graph Data dialog box.

    For example, if the values displayed on the chart (based on the data field) are 1,2 4 8, these would be the slices on the pie. I want to explode the slice that has the value of 8.

    Is this what you need to help me?
    Thank you
    Tracy




    Quote Originally Posted by Keith Hubert View Post
    Hi Tracy,

    I can confirm the pie chart can be made to explode. Can you post a sample of what you have so far.

  5. #5
    Member
    Real Name
    t walker
    Join Date
    Mar 2012
    Location
    USA
    Posts
    230

    Default Re: "explode" slice of a pie chart

    Hi Keith,

    Is the information that I posted in my previous thread what you were looking for to figure out where I went wrong.

    Let me know
    Thank you
    Tracy

  6. #6
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: "explode" slice of a pie chart

    Take a look at the AlphaSports ProductSalesByState form.

    I was able to explode the largest slice in the Number of Sales by State chart by entering Bill_State_Region = "MA" in the Explode Slice box in the supercontrol designer. Are you wanting to automatically explode whichever slice is the largest?

    slice separated.png
    There can be only one.

  7. #7
    Member
    Real Name
    t walker
    Join Date
    Mar 2012
    Location
    USA
    Posts
    230

    Default Re: "explode" slice of a pie chart

    Hi Stan,

    Yes, I want tp automatically explode whichever slice is the largest.

    Tracy

  8. #8
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: "explode" slice of a pie chart

    There is no built in method to do that I know about. Likely you will have to create a summarization operation and find the key value in the record with the largest value, put that value in a global variable. Then reference that variable in the explode slice expression.

    Easily enough done and should execute quickly.
    There can be only one.

  9. #9
    Member
    Real Name
    t walker
    Join Date
    Mar 2012
    Location
    USA
    Posts
    230

    Default Re: "explode" slice of a pie chart

    Wow Stan,

    I wasn't expecting to have to create a formula to find the largest value.
    I'm starting to think that it may be best to leave the reports in Crystal, if I can attach to the A5 database in Crystal.
    I don't know if you have used Crystal Reports, but there is a check box to explode the largest or smallest slice of a pie. No formula (on my part) required.

    Thank you
    Tracy

  10. #10
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: "explode" slice of a pie chart

    There is no built in method to do that I know about.
    It may be there and I don't know it. Don't really have any use for charts.
    There can be only one.

  11. #11
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: "explode" slice of a pie chart

    It appears the supercontrol designer uses "the Graph ActiveX control installed by Microsoft Office". If automatic explosion is available there one should be able to access it.

    there is a check box to explode the largest or smallest slice of a pie
    I would expect a custom reporting tool to have more features than those found in Alpha. Especially given the ~ $400 price?
    There can be only one.

  12. #12
    Member
    Real Name
    t walker
    Join Date
    Mar 2012
    Location
    USA
    Posts
    230

    Default Re: "explode" slice of a pie chart

    Hi Stan,

    As you suggested, I looked in the AlphaSports database. The problem I had was that I didn't see that you said it was a form I was looking for a report. Now, that I can read a little better . . . I looked at the "form", to see what was done to explode a slice.

    I will see how close I can come to selecting a slice.

    Thank you
    Tracy

    Quote Originally Posted by Stan Mathews View Post
    Take a look at the AlphaSports ProductSalesByState form.

    I was able to explode the largest slice in the Number of Sales by State chart by entering Bill_State_Region = "MA" in the Explode Slice box in the supercontrol designer. Are you wanting to automatically explode whichever slice is the largest?

    slice separated.png

  13. #13
    Member
    Real Name
    t walker
    Join Date
    Mar 2012
    Location
    USA
    Posts
    230

    Default Re: "explode" slice of a pie chart

    I saw the Graph ActivX help page, but couldn't figure out where it was to use, so I figured that either it is no longer available or only available in xdialog, which I am not that familar with.


    I honestly didn't think that this was an advanced feature, as it can be done in Excel, not that Excel doesn't have advanced features.




    Quote Originally Posted by Stan Mathews View Post
    It appears the supercontrol designer uses "the Graph ActiveX control installed by Microsoft Office". If automatic explosion is available there one should be able to access it.

    I would expect a custom reporting tool to have more features than those found in Alpha. Especially given the ~ $400 price?

  14. #14
    "Certified" Alphaholic G Gabriel's Avatar
    Real Name
    G. Gabriel
    Join Date
    Oct 2004
    Posts
    7,204

    Default Re: "explode" slice of a pie chart

    Here..you could explode your pie and eat it too..
    Code:
    values=<<%str%
    10|Apples
    15|Oranges
    30|Bananas
    45|Berries
    %str%
    values=sortsubstr(values,crlf(),"D")
    
    colors=<<%c%
    red
    Yellow
    Blue
    green
    %c%
    
    cnt=*count(values)
    dim tot as n=0
    for i=1 to cnt
    tot=tot+val(word(values,i,crlf()))
    next
    
    dim cod_txt as c
    cod_txt=<<%ct%
    inner_Rect(0,0,4,4)
    set_pen("black","solid",4)
    %ct%
    
    dim ang as n=0
    dim cumang as n=0
    for i=1 to cnt
    	cumang=cumang+ang
    ang=val(word(values,i,crlf()))/tot*360
    	cumang1=cumang+ang/2
    	xdsp=1.65+cos(dtor(cumang1))
    	ydsp=2+sin(dtor(cumang1))	
    	
    bcgclr=quote(word(word(values,i,crlf()),2,"|"))
    cod_txt=cod_txt+crlf()+"set_brush("+quote(word(colors,i,crlf()))+")"+crlf()+"fill_pie(2,2,1.5,"+ang+","+cumang+","+if(i=1,.2,0)+")"+crlf()+"set_font(\"arial,12\",\"black\","+bcgclr+")"+crlf()+"text("+bcgclr+","+xdsp+","+ydsp+")"
    next
    ui_bitmap_draw("test",cod_txt)
    ui_dlg_box("","{image=test}")
    I could fancy this up a whole lot more..but its a basic one to get you going.

  15. #15
    "Certified" Alphaholic
    Real Name
    Raymond Lyons
    Join Date
    Apr 2000
    Location
    Carlsbad, CA
    Posts
    2,143

    Default Re: "explode" slice of a pie chart

    Here..you could explode your pie and eat it too....

    I could fancy this up a whole lot more..but its a basic one to get you going.
    G, I am pretty sure this not what Tracy was looking for as a way to produce a chart. A small number of us have done charts using Xbasic tools like you used here, and it just goes to show (I believe) that easy to use charts could be made a part of Alpha Five without resorting to third party add-in tools that end up leaving a lot to be desired. But Alpha probably has far more lucrative things to do with their limited resources, so we either spend the time doing the kind of thing you illustrated or we somehow try to make the third party stuff work--or go to something like Crystal Reports. Years ago I did a very complex chart using the tools you illustrate (and it is still working flawlessly today up to at least V10.5) but there was a huge learning curve and it took a tremendous amount of time to do it. I would do simple charts that way again, but never a very complex one--unless I were being paid by the hour!

    By the way, glad to see you are back contributing on the forum.

    Raymond Lyons

  16. #16
    "Certified" Alphaholic Ronald Anusiewicz's Avatar
    Real Name
    Ronald Anusiewicz
    Join Date
    Oct 2000
    Location
    Southampton, MA
    Posts
    1,583

    Default Re: "explode" slice of a pie chart

    G,

    I tried your code and I get an error message.
    Referencing the error message and the help files, I do not see anything wrong with the code.
    I was wondering if anyone else has run this successfully.

    I'm running a fairly recent pre-release. Maybe there's a bug?
    Attached Images Attached Images

  17. #17
    "Certified" Alphaholic Ronald Anusiewicz's Avatar
    Real Name
    Ronald Anusiewicz
    Join Date
    Oct 2000
    Location
    Southampton, MA
    Posts
    1,583

    Default Re: "explode" slice of a pie chart

    Never mind, I misread the help file.

  18. #18
    Member
    Real Name
    t walker
    Join Date
    Mar 2012
    Location
    USA
    Posts
    230

    Default Re: "explode" slice of a pie chart

    hi G Gabriel,
    I don't know xbasic, but I will give it a whirl. Thank you
    Tracy

  19. #19
    "Certified" Alphaholic
    Real Name
    Raymond Lyons
    Join Date
    Apr 2000
    Location
    Carlsbad, CA
    Posts
    2,143

    Default Re: "explode" slice of a pie chart

    Quote Originally Posted by Ronald Anusiewicz View Post
    G,

    I tried your code and I get an error message.
    Referencing the error message and the help files, I do not see anything wrong with the code.
    I was wondering if anyone else has run this successfully.

    I'm running a fairly recent pre-release. Maybe there's a bug?
    Ron, I think G's code left out a line. Try sticking this:
    Code:
    ui_bitmap_create("test", 4.0, 4.0)
    in at the beginning. This should show it on the screen with G's code.

    As for putting it in a report, I have done it 2 ways. One is to save the image to a file, a file that then appears in a report layout. The other way I have done it is put everything needed for the report in the code that generates the image (fields, titles, calcs, etc.) and then send the whole thing to the printer (no report layout) with ui_printer_draw() or sys_print() using the saved image file. My work in this area was done years ago, so none of it is fresh in my mind. But it is all still working, at least in V10.5.

    Raymond Lyons

  20. #20
    Member
    Real Name
    t walker
    Join Date
    Mar 2012
    Location
    USA
    Posts
    230

    Default Re: "explode" slice of a pie chart

    Hi Raymond,

    Yes, I am having quite a time trying to duplicate charts that I have already created in Crystal Reports. I really wanted to keep the entire application in Alpha Five, but it doesn't seem possible. I will have to keep the reports in Crystal, which defeats the purpose (to me anyway) of converting data in Access to Alpha Five.



    Quote Originally Posted by Raymond Lyons View Post
    G, I am pretty sure this not what Tracy was looking for as a way to produce a chart. A small number of us have done charts using Xbasic tools like you used here, and it just goes to show (I believe) that easy to use charts could be made a part of Alpha Five without resorting to third party add-in tools that end up leaving a lot to be desired. But Alpha probably has far more lucrative things to do with their limited resources, so we either spend the time doing the kind of thing you illustrated or we somehow try to make the third party stuff work--or go to something like Crystal Reports. Years ago I did a very complex chart using the tools you illustrate (and it is still working flawlessly today up to at least V10.5) but there was a huge learning curve and it took a tremendous amount of time to do it. I would do simple charts that way again, but never a very complex one--unless I were being paid by the hour!

    By the way, glad to see you are back contributing on the forum.

    Raymond Lyons

  21. #21
    "Certified" Alphaholic
    Real Name
    Raymond Lyons
    Join Date
    Apr 2000
    Location
    Carlsbad, CA
    Posts
    2,143

    Default Re: "explode" slice of a pie chart

    Quote Originally Posted by noviceuser View Post
    Hi Raymond,

    Yes, I am having quite a time trying to duplicate charts that I have already created in Crystal Reports. I really wanted to keep the entire application in Alpha Five, but it doesn't seem possible. I will have to keep the reports in Crystal, which defeats the purpose (to me anyway) of converting data in Access to Alpha Five.
    There are, possibly, 2 solutions to your problem. Given that you are a self described novice user, the method G, Gabriel outlined is probably way too complex. The other way to do charts in Alpha Five is (I think) via a third party add-in (Simple Charts?). I would think there is a way to do what you want with whatever the add-in is called, but I am not the one to help you with that since I have never created a single chart that way.

    Maybe someone else can help. Sorry.

    Raymond Lyons

  22. #22
    "Certified" Alphaholic Ronald Anusiewicz's Avatar
    Real Name
    Ronald Anusiewicz
    Join Date
    Oct 2000
    Location
    Southampton, MA
    Posts
    1,583

    Default Re: "explode" slice of a pie chart

    As G said, his example was to get one started.

    Well, I decided to play around with his code a little. The attached script has an embedded function that make it fairly easy to generate a simple pie chart. It can be improved upon. If anyone decides to use this code and does improve it, please post your changes.

    Ron
    Attached Files Attached Files

  23. #23
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    7,757

    Default Re: "explode" slice of a pie chart

    Hey Tracy,

    Thought I'd take a shot at this... it sure isn't as easy as I thought it might be... but still, not that bad. All this assumes you're working with the Chart Supercontrol.

    Part of the trouble is trying to provide an answer for your database without knowing how you have your pie chart running. So I opened the current Alphasports database and started working with the report named "Invoice_WithPieChart". You should walk through this example with this report to get a better understanding of how this works. There may be easier, more straight forward solutions but they are evading me. Anyway, here's one solution.

    Get into design mode for this report, and get into the Chart Supercontrol properties. Your Data Source is probably set to Report but I can't get an exploded pie with this source. We need to change the Source to Table and then provide a Table name which is "Invoice.set". We need to filter the Table but I didn't have a lot of luck here either - I just wanted to provide a Report Field to do this but the dialogs wouldn't let me. So I had to create an argument. For Arguments create an argument called CURRINVNBR. In Argument Bindings... bind CURRINVNBR to invoice_number. Now the property Filter Records can read invoice_number = :CURRINVNBR

    So far, all we've done is tell the chart that we're basing data on the Table (or set, in this case) Invoice.set, and to filter this data on the report field invoice_number.

    The final step is to set up the explode. In the Explode Slice property, put this...

    Code:
    Invoice_Items->Extension=tablemax("invoice_items","invoice_number='"+Invoice_Number+"'","Extension")
    This pie chart is based on the Extension price of the different items for this invoice. The Explode expression is saying... Extension = the maximum value of Extension, for the current invoice number, from the invoice_items set. The Explode expression must be a logical expression.

    This process seems to be easier for a Form, but a bit more involved for a report. Again... there may be a simpler way. I had a quick look through the Object properties of the chart and saw a couple of interesting items regarding Explode but I've no idea how to use them. At least this solution does work. Attached are images that kind of walk you through the process I described.
    Attached Images Attached Images

  24. #24
    "Certified" Alphaholic Ronald Anusiewicz's Avatar
    Real Name
    Ronald Anusiewicz
    Join Date
    Oct 2000
    Location
    Southampton, MA
    Posts
    1,583

    Default Re: "explode" slice of a pie chart

    I continued to play with this some more adding some text.
    Nice if you just want show a dialog box with a simple graph.
    Attached Images Attached Images
    Attached Files Attached Files

  25. #25
    "Certified" Alphaholic
    Real Name
    Raymond Lyons
    Join Date
    Apr 2000
    Location
    Carlsbad, CA
    Posts
    2,143

    Default Re: "explode" slice of a pie chart

    Quote Originally Posted by Ronald Anusiewicz View Post
    I continued to play with this some more adding some text.
    Nice if you just want show a dialog box with a simple graph.
    Ron,

    I'm pretty sure you know Tracy was looking to put her chart in a report, and of course you are just playing around (playing around with the tools can be fun--and get complex).

    As I indicated in a post above, I have put such charts in reports two different ways. The simpliest (I think) way is to save the chart to a temp bitmap file and them put the bitmap in the report. Of course this won't work if each record in the report calls for a different bitmap, but otherwise it works well enough. I suppose one could try to use the Report On_Record event to create a new bitmap for each record, but that sounds very unwieldly to me

    Anyway, try adding lines like this to your code:
    Code:
    '++++++++ Now create and save it to a bmp file
    dim ptr as p
    PieChart_Temp = ui_bitmap_save("test")
    ptr = file.create("c:\PieChart_Temp.bmp", FILE_RW_EXCLUSIVE)
    ptr.writeb(PieChart_Temp)
    ptr.close()
    '***********
    Note that you could change the file extension to .jpg or .png but the file created would still be a bmp. Other tools in the graphics toolkit can change the bmp into a jpg or png.

    Raymond Lyons

  26. #26
    Member
    Real Name
    t walker
    Join Date
    Mar 2012
    Location
    USA
    Posts
    230

    Default Re: "explode" slice of a pie chart

    I wanted to say thank you to everyone that responded to this thread. I was finally able to get the explode feature to work.
    Thank you
    Tracy

Similar Threads

  1. Pie chart questions
    By noviceuser in forum Alpha Five Version 11 - Desktop Applications
    Replies: 9
    Last Post: 01-15-2013, 05:31 PM
  2. Need "Excel-like" chart in A5
    By Peter.Greulich in forum Application Server Version 11 - Web/Browser Applications
    Replies: 5
    Last Post: 10-12-2012, 11:00 AM
  3. Stuck with pie chart :(
    By flippah358 in forum Application Server Version 9 - Web/Browser Applications
    Replies: 2
    Last Post: 05-30-2009, 12:23 PM
  4. form.view("fName","","","center","center")
    By reynolditpi in forum Alpha Five Version 9 - Desktop Applications
    Replies: 5
    Last Post: 07-15-2008, 12:37 AM
  5. "Add" and "Save" buttons don't stay on "Self" page
    By Scholin in forum Application Server Version 8
    Replies: 2
    Last Post: 02-05-2008, 08:50 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •