PiePlot.html 357 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html lang="en">
  3. <head>
  4. <title>Source code</title>
  5. <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
  6. </head>
  7. <body>
  8. <div class="sourceContainer">
  9. <pre><span class="sourceLineNo">001</span>/* ===========================================================<a name="line.1"></a>
  10. <span class="sourceLineNo">002</span> * JFreeChart : a free chart library for the Java(tm) platform<a name="line.2"></a>
  11. <span class="sourceLineNo">003</span> * ===========================================================<a name="line.3"></a>
  12. <span class="sourceLineNo">004</span> *<a name="line.4"></a>
  13. <span class="sourceLineNo">005</span> * (C) Copyright 2000-2014, by Object Refinery Limited and Contributors.<a name="line.5"></a>
  14. <span class="sourceLineNo">006</span> *<a name="line.6"></a>
  15. <span class="sourceLineNo">007</span> * Project Info: http://www.jfree.org/jfreechart/index.html<a name="line.7"></a>
  16. <span class="sourceLineNo">008</span> *<a name="line.8"></a>
  17. <span class="sourceLineNo">009</span> * This library is free software; you can redistribute it and/or modify it<a name="line.9"></a>
  18. <span class="sourceLineNo">010</span> * under the terms of the GNU Lesser General Public License as published by<a name="line.10"></a>
  19. <span class="sourceLineNo">011</span> * the Free Software Foundation; either version 2.1 of the License, or<a name="line.11"></a>
  20. <span class="sourceLineNo">012</span> * (at your option) any later version.<a name="line.12"></a>
  21. <span class="sourceLineNo">013</span> *<a name="line.13"></a>
  22. <span class="sourceLineNo">014</span> * This library is distributed in the hope that it will be useful, but<a name="line.14"></a>
  23. <span class="sourceLineNo">015</span> * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY<a name="line.15"></a>
  24. <span class="sourceLineNo">016</span> * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public<a name="line.16"></a>
  25. <span class="sourceLineNo">017</span> * License for more details.<a name="line.17"></a>
  26. <span class="sourceLineNo">018</span> *<a name="line.18"></a>
  27. <span class="sourceLineNo">019</span> * You should have received a copy of the GNU Lesser General Public<a name="line.19"></a>
  28. <span class="sourceLineNo">020</span> * License along with this library; if not, write to the Free Software<a name="line.20"></a>
  29. <span class="sourceLineNo">021</span> * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,<a name="line.21"></a>
  30. <span class="sourceLineNo">022</span> * USA.<a name="line.22"></a>
  31. <span class="sourceLineNo">023</span> *<a name="line.23"></a>
  32. <span class="sourceLineNo">024</span> * [Oracle and Java are registered trademarks of Oracle and/or its affiliates. <a name="line.24"></a>
  33. <span class="sourceLineNo">025</span> * Other names may be trademarks of their respective owners.]<a name="line.25"></a>
  34. <span class="sourceLineNo">026</span> *<a name="line.26"></a>
  35. <span class="sourceLineNo">027</span> * ------------<a name="line.27"></a>
  36. <span class="sourceLineNo">028</span> * PiePlot.java<a name="line.28"></a>
  37. <span class="sourceLineNo">029</span> * ------------<a name="line.29"></a>
  38. <span class="sourceLineNo">030</span> * (C) Copyright 2000-2014, by Andrzej Porebski and Contributors.<a name="line.30"></a>
  39. <span class="sourceLineNo">031</span> *<a name="line.31"></a>
  40. <span class="sourceLineNo">032</span> * Original Author: Andrzej Porebski;<a name="line.32"></a>
  41. <span class="sourceLineNo">033</span> * Contributor(s): David Gilbert (for Object Refinery Limited);<a name="line.33"></a>
  42. <span class="sourceLineNo">034</span> * Martin Cordova (percentages in labels);<a name="line.34"></a>
  43. <span class="sourceLineNo">035</span> * Richard Atkinson (URL support for image maps);<a name="line.35"></a>
  44. <span class="sourceLineNo">036</span> * Christian W. Zuckschwerdt;<a name="line.36"></a>
  45. <span class="sourceLineNo">037</span> * Arnaud Lelievre;<a name="line.37"></a>
  46. <span class="sourceLineNo">038</span> * Martin Hilpert (patch 1891849);<a name="line.38"></a>
  47. <span class="sourceLineNo">039</span> * Andreas Schroeder (very minor);<a name="line.39"></a>
  48. <span class="sourceLineNo">040</span> * Christoph Beck (bug 2121818);<a name="line.40"></a>
  49. <span class="sourceLineNo">041</span> *<a name="line.41"></a>
  50. <span class="sourceLineNo">042</span> * Changes<a name="line.42"></a>
  51. <span class="sourceLineNo">043</span> * -------<a name="line.43"></a>
  52. <span class="sourceLineNo">044</span> * 21-Jun-2001 : Removed redundant JFreeChart parameter from constructors (DG);<a name="line.44"></a>
  53. <span class="sourceLineNo">045</span> * 18-Sep-2001 : Updated header (DG);<a name="line.45"></a>
  54. <span class="sourceLineNo">046</span> * 15-Oct-2001 : Data source classes moved to com.jrefinery.data.* (DG);<a name="line.46"></a>
  55. <span class="sourceLineNo">047</span> * 19-Oct-2001 : Moved series paint and stroke methods from JFreeChart.java to<a name="line.47"></a>
  56. <span class="sourceLineNo">048</span> * Plot.java (DG);<a name="line.48"></a>
  57. <span class="sourceLineNo">049</span> * 22-Oct-2001 : Renamed DataSource.java --&gt; Dataset.java etc. (DG);<a name="line.49"></a>
  58. <span class="sourceLineNo">050</span> * 13-Nov-2001 : Modified plot subclasses so that null axes are possible for<a name="line.50"></a>
  59. <span class="sourceLineNo">051</span> * pie plot (DG);<a name="line.51"></a>
  60. <span class="sourceLineNo">052</span> * 17-Nov-2001 : Added PieDataset interface and amended this class accordingly,<a name="line.52"></a>
  61. <span class="sourceLineNo">053</span> * and completed removal of BlankAxis class as it is no longer<a name="line.53"></a>
  62. <span class="sourceLineNo">054</span> * required (DG);<a name="line.54"></a>
  63. <span class="sourceLineNo">055</span> * 19-Nov-2001 : Changed 'drawCircle' property to 'circular' property (DG);<a name="line.55"></a>
  64. <span class="sourceLineNo">056</span> * 21-Nov-2001 : Added options for exploding pie sections and filled out range<a name="line.56"></a>
  65. <span class="sourceLineNo">057</span> * of properties (DG);<a name="line.57"></a>
  66. <span class="sourceLineNo">058</span> * Added option for percentages in chart labels, based on code<a name="line.58"></a>
  67. <span class="sourceLineNo">059</span> * by Martin Cordova (DG);<a name="line.59"></a>
  68. <span class="sourceLineNo">060</span> * 30-Nov-2001 : Changed default font from "Arial" --&gt; "SansSerif" (DG);<a name="line.60"></a>
  69. <span class="sourceLineNo">061</span> * 12-Dec-2001 : Removed unnecessary 'throws' clause in constructor (DG);<a name="line.61"></a>
  70. <span class="sourceLineNo">062</span> * 13-Dec-2001 : Added tooltips (DG);<a name="line.62"></a>
  71. <span class="sourceLineNo">063</span> * 16-Jan-2002 : Renamed tooltips class (DG);<a name="line.63"></a>
  72. <span class="sourceLineNo">064</span> * 22-Jan-2002 : Fixed bug correlating legend labels with pie data (DG);<a name="line.64"></a>
  73. <span class="sourceLineNo">065</span> * 05-Feb-2002 : Added alpha-transparency to plot class, and updated<a name="line.65"></a>
  74. <span class="sourceLineNo">066</span> * constructors accordingly (DG);<a name="line.66"></a>
  75. <span class="sourceLineNo">067</span> * 06-Feb-2002 : Added optional background image and alpha-transparency to Plot<a name="line.67"></a>
  76. <span class="sourceLineNo">068</span> * and subclasses. Clipped drawing within plot area (DG);<a name="line.68"></a>
  77. <span class="sourceLineNo">069</span> * 26-Mar-2002 : Added an empty zoom method (DG);<a name="line.69"></a>
  78. <span class="sourceLineNo">070</span> * 18-Apr-2002 : PieDataset is no longer sorted (oldman);<a name="line.70"></a>
  79. <span class="sourceLineNo">071</span> * 23-Apr-2002 : Moved dataset from JFreeChart to Plot. Added<a name="line.71"></a>
  80. <span class="sourceLineNo">072</span> * getLegendItemLabels() method (DG);<a name="line.72"></a>
  81. <span class="sourceLineNo">073</span> * 19-Jun-2002 : Added attributes to control starting angle and direction<a name="line.73"></a>
  82. <span class="sourceLineNo">074</span> * (default is now clockwise) (DG);<a name="line.74"></a>
  83. <span class="sourceLineNo">075</span> * 25-Jun-2002 : Removed redundant imports (DG);<a name="line.75"></a>
  84. <span class="sourceLineNo">076</span> * 02-Jul-2002 : Fixed sign of percentage bug introduced in 0.9.2 (DG);<a name="line.76"></a>
  85. <span class="sourceLineNo">077</span> * 16-Jul-2002 : Added check for null dataset in getLegendItemLabels() (DG);<a name="line.77"></a>
  86. <span class="sourceLineNo">078</span> * 30-Jul-2002 : Moved summation code to DatasetUtilities (DG);<a name="line.78"></a>
  87. <span class="sourceLineNo">079</span> * 05-Aug-2002 : Added URL support for image maps - new member variable for<a name="line.79"></a>
  88. <span class="sourceLineNo">080</span> * urlGenerator, modified constructor and minor change to the<a name="line.80"></a>
  89. <span class="sourceLineNo">081</span> * draw method (RA);<a name="line.81"></a>
  90. <span class="sourceLineNo">082</span> * 18-Sep-2002 : Modified the percent label creation and added setters for the<a name="line.82"></a>
  91. <span class="sourceLineNo">083</span> * formatters (AS);<a name="line.83"></a>
  92. <span class="sourceLineNo">084</span> * 24-Sep-2002 : Added getLegendItems() method (DG);<a name="line.84"></a>
  93. <span class="sourceLineNo">085</span> * 02-Oct-2002 : Fixed errors reported by Checkstyle (DG);<a name="line.85"></a>
  94. <span class="sourceLineNo">086</span> * 09-Oct-2002 : Added check for null entity collection (DG);<a name="line.86"></a>
  95. <span class="sourceLineNo">087</span> * 30-Oct-2002 : Changed PieDataset interface (DG);<a name="line.87"></a>
  96. <span class="sourceLineNo">088</span> * 18-Nov-2002 : Changed CategoryDataset to TableDataset (DG);<a name="line.88"></a>
  97. <span class="sourceLineNo">089</span> * 02-Jan-2003 : Fixed "no data" message (DG);<a name="line.89"></a>
  98. <span class="sourceLineNo">090</span> * 23-Jan-2003 : Modified to extract data from rows OR columns in<a name="line.90"></a>
  99. <span class="sourceLineNo">091</span> * CategoryDataset (DG);<a name="line.91"></a>
  100. <span class="sourceLineNo">092</span> * 14-Feb-2003 : Fixed label drawing so that foreground alpha does not apply<a name="line.92"></a>
  101. <span class="sourceLineNo">093</span> * (bug id 685536) (DG);<a name="line.93"></a>
  102. <span class="sourceLineNo">094</span> * 07-Mar-2003 : Modified to pass pieIndex on to PieSectionEntity and tooltip<a name="line.94"></a>
  103. <span class="sourceLineNo">095</span> * and URL generators (DG);<a name="line.95"></a>
  104. <span class="sourceLineNo">096</span> * 21-Mar-2003 : Added a minimum angle for drawing arcs<a name="line.96"></a>
  105. <span class="sourceLineNo">097</span> * (see bug id 620031) (DG);<a name="line.97"></a>
  106. <span class="sourceLineNo">098</span> * 24-Apr-2003 : Switched around PieDataset and KeyedValuesDataset (DG);<a name="line.98"></a>
  107. <span class="sourceLineNo">099</span> * 02-Jun-2003 : Fixed bug 721733 (DG);<a name="line.99"></a>
  108. <span class="sourceLineNo">100</span> * 30-Jul-2003 : Modified entity constructor (CZ);<a name="line.100"></a>
  109. <span class="sourceLineNo">101</span> * 19-Aug-2003 : Implemented Cloneable (DG);<a name="line.101"></a>
  110. <span class="sourceLineNo">102</span> * 29-Aug-2003 : Fixed bug 796936 (null pointer on setOutlinePaint()) (DG);<a name="line.102"></a>
  111. <span class="sourceLineNo">103</span> * 08-Sep-2003 : Added internationalization via use of properties<a name="line.103"></a>
  112. <span class="sourceLineNo">104</span> * resourceBundle (RFE 690236) (AL);<a name="line.104"></a>
  113. <span class="sourceLineNo">105</span> * 16-Sep-2003 : Changed ChartRenderingInfo --&gt; PlotRenderingInfo (DG);<a name="line.105"></a>
  114. <span class="sourceLineNo">106</span> * 29-Oct-2003 : Added workaround for font alignment in PDF output (DG);<a name="line.106"></a>
  115. <span class="sourceLineNo">107</span> * 05-Nov-2003 : Fixed missing legend bug (DG);<a name="line.107"></a>
  116. <span class="sourceLineNo">108</span> * 10-Nov-2003 : Re-added the DatasetChangeListener to constructors (CZ);<a name="line.108"></a>
  117. <span class="sourceLineNo">109</span> * 29-Jan-2004 : Fixed clipping bug in draw() method (DG);<a name="line.109"></a>
  118. <span class="sourceLineNo">110</span> * 11-Mar-2004 : Major overhaul to improve labelling (DG);<a name="line.110"></a>
  119. <span class="sourceLineNo">111</span> * 31-Mar-2004 : Made an adjustment for the plot area when the label generator<a name="line.111"></a>
  120. <span class="sourceLineNo">112</span> * is null. Fixed null pointer exception when the label<a name="line.112"></a>
  121. <span class="sourceLineNo">113</span> * generator returns null for a label (DG);<a name="line.113"></a>
  122. <span class="sourceLineNo">114</span> * 06-Apr-2004 : Added getter, setter, serialization and draw support for<a name="line.114"></a>
  123. <span class="sourceLineNo">115</span> * labelBackgroundPaint (AS);<a name="line.115"></a>
  124. <span class="sourceLineNo">116</span> * 08-Apr-2004 : Added flag to control whether null values are ignored or<a name="line.116"></a>
  125. <span class="sourceLineNo">117</span> * not (DG);<a name="line.117"></a>
  126. <span class="sourceLineNo">118</span> * 15-Apr-2004 : Fixed some minor warnings from Eclipse (DG);<a name="line.118"></a>
  127. <span class="sourceLineNo">119</span> * 26-Apr-2004 : Added attributes for label outline and shadow (DG);<a name="line.119"></a>
  128. <span class="sourceLineNo">120</span> * 04-Oct-2004 : Renamed ShapeUtils --&gt; ShapeUtilities (DG);<a name="line.120"></a>
  129. <span class="sourceLineNo">121</span> * 04-Nov-2004 : Fixed null pointer exception with new LegendTitle class (DG);<a name="line.121"></a>
  130. <span class="sourceLineNo">122</span> * 09-Nov-2004 : Added user definable legend item shape (DG);<a name="line.122"></a>
  131. <span class="sourceLineNo">123</span> * 25-Nov-2004 : Added new legend label generator (DG);<a name="line.123"></a>
  132. <span class="sourceLineNo">124</span> * 20-Apr-2005 : Added a tool tip generator for legend labels (DG);<a name="line.124"></a>
  133. <span class="sourceLineNo">125</span> * 26-Apr-2005 : Removed LOGGER (DG);<a name="line.125"></a>
  134. <span class="sourceLineNo">126</span> * 05-May-2005 : Updated draw() method parameters (DG);<a name="line.126"></a>
  135. <span class="sourceLineNo">127</span> * 10-May-2005 : Added flag to control visibility of label linking lines, plus<a name="line.127"></a>
  136. <span class="sourceLineNo">128</span> * another flag to control the handling of zero values (DG);<a name="line.128"></a>
  137. <span class="sourceLineNo">129</span> * 08-Jun-2005 : Fixed bug in getLegendItems() method (not respecting flags<a name="line.129"></a>
  138. <span class="sourceLineNo">130</span> * for ignoring null and zero values), and fixed equals() method<a name="line.130"></a>
  139. <span class="sourceLineNo">131</span> * to handle GradientPaint (DG);<a name="line.131"></a>
  140. <span class="sourceLineNo">132</span> * 15-Jul-2005 : Added sectionOutlinesVisible attribute (DG);<a name="line.132"></a>
  141. <span class="sourceLineNo">133</span> * ------------- JFREECHART 1.0.x ---------------------------------------------<a name="line.133"></a>
  142. <span class="sourceLineNo">134</span> * 09-Jan-2006 : Fixed bug 1400442, inconsistent treatment of null and zero<a name="line.134"></a>
  143. <span class="sourceLineNo">135</span> * values in dataset (DG);<a name="line.135"></a>
  144. <span class="sourceLineNo">136</span> * 28-Feb-2006 : Fixed bug 1440415, bad distribution of pie section<a name="line.136"></a>
  145. <span class="sourceLineNo">137</span> * labels (DG);<a name="line.137"></a>
  146. <span class="sourceLineNo">138</span> * 27-Sep-2006 : Initialised baseSectionPaint correctly, added lookup methods<a name="line.138"></a>
  147. <span class="sourceLineNo">139</span> * for section paint, outline paint and outline stroke (DG);<a name="line.139"></a>
  148. <span class="sourceLineNo">140</span> * 27-Sep-2006 : Refactored paint and stroke methods to use keys rather than<a name="line.140"></a>
  149. <span class="sourceLineNo">141</span> * section indices (DG);<a name="line.141"></a>
  150. <span class="sourceLineNo">142</span> * 03-Oct-2006 : Replaced call to JRE 1.5 method (DG);<a name="line.142"></a>
  151. <span class="sourceLineNo">143</span> * 23-Nov-2006 : Added support for URLs for the legend items (DG);<a name="line.143"></a>
  152. <span class="sourceLineNo">144</span> * 24-Nov-2006 : Cloning fixes (DG);<a name="line.144"></a>
  153. <span class="sourceLineNo">145</span> * 17-Apr-2007 : Check for null label in legend items (DG);<a name="line.145"></a>
  154. <span class="sourceLineNo">146</span> * 19-Apr-2007 : Deprecated override settings (DG);<a name="line.146"></a>
  155. <span class="sourceLineNo">147</span> * 18-May-2007 : Set dataset for LegendItem (DG);<a name="line.147"></a>
  156. <span class="sourceLineNo">148</span> * 14-Jun-2007 : Added label distributor attribute (DG);<a name="line.148"></a>
  157. <span class="sourceLineNo">149</span> * 18-Jul-2007 : Added simple label option (DG);<a name="line.149"></a>
  158. <span class="sourceLineNo">150</span> * 21-Nov-2007 : Fixed labelling bugs, added debug code, restored default<a name="line.150"></a>
  159. <span class="sourceLineNo">151</span> * white background (DG);<a name="line.151"></a>
  160. <span class="sourceLineNo">152</span> * 19-Mar-2008 : Fixed IllegalArgumentException when drawing with null<a name="line.152"></a>
  161. <span class="sourceLineNo">153</span> * dataset (DG);<a name="line.153"></a>
  162. <span class="sourceLineNo">154</span> * 31-Mar-2008 : Adjust the label area for the interiorGap (DG);<a name="line.154"></a>
  163. <span class="sourceLineNo">155</span> * 31-Mar-2008 : Added quad and cubic curve label link lines - see patch<a name="line.155"></a>
  164. <span class="sourceLineNo">156</span> * 1891849 by Martin Hilpert (DG);<a name="line.156"></a>
  165. <span class="sourceLineNo">157</span> * 02-Jul-2008 : Added autoPopulate flags (DG);<a name="line.157"></a>
  166. <span class="sourceLineNo">158</span> * 15-Aug-2008 : Added methods to clear section attributes (DG);<a name="line.158"></a>
  167. <span class="sourceLineNo">159</span> * 15-Aug-2008 : Fixed bug 2051168 - problem with LegendItemEntity<a name="line.159"></a>
  168. <span class="sourceLineNo">160</span> * generation (DG);<a name="line.160"></a>
  169. <span class="sourceLineNo">161</span> * 23-Sep-2008 : Added getLabelLinkDepth() method - see bug 2121818 reported<a name="line.161"></a>
  170. <span class="sourceLineNo">162</span> * by Christoph Beck (DG);<a name="line.162"></a>
  171. <span class="sourceLineNo">163</span> * 18-Dec-2008 : Use ResourceBundleWrapper - see patch 1607918 by<a name="line.163"></a>
  172. <span class="sourceLineNo">164</span> * Jess Thrysoee (DG);<a name="line.164"></a>
  173. <span class="sourceLineNo">165</span> * 10-Jul-2009 : Added optional drop shadow generator (DG);<a name="line.165"></a>
  174. <span class="sourceLineNo">166</span> * 03-Sep-2009 : Fixed bug where sinmpleLabelOffset is ignored (DG);<a name="line.166"></a>
  175. <span class="sourceLineNo">167</span> * 04-Nov-2009 : Add mouse wheel rotation support (DG);<a name="line.167"></a>
  176. <span class="sourceLineNo">168</span> * 18-Oct-2011 : Fixed tooltip offset with shadow generator (DG);<a name="line.168"></a>
  177. <span class="sourceLineNo">169</span> * 20-Nov-2011 : Initialise shadow generator as null (DG);<a name="line.169"></a>
  178. <span class="sourceLineNo">170</span> * 01-Jul-2012 : General label once only in drawSimpleLabels() (DG);<a name="line.170"></a>
  179. <span class="sourceLineNo">171</span> * 02-Jul-2013 : Use ParamChecks (DG);<a name="line.171"></a>
  180. <span class="sourceLineNo">172</span> * 12-Sep-2013 : Check for KEY_SUPPRESS_SHADOW_GENERATION rendering hint (DG);<a name="line.172"></a>
  181. <span class="sourceLineNo">173</span> * <a name="line.173"></a>
  182. <span class="sourceLineNo">174</span> */<a name="line.174"></a>
  183. <span class="sourceLineNo">175</span><a name="line.175"></a>
  184. <span class="sourceLineNo">176</span>package org.jfree.chart.plot;<a name="line.176"></a>
  185. <span class="sourceLineNo">177</span><a name="line.177"></a>
  186. <span class="sourceLineNo">178</span>import java.awt.AlphaComposite;<a name="line.178"></a>
  187. <span class="sourceLineNo">179</span>import java.awt.BasicStroke;<a name="line.179"></a>
  188. <span class="sourceLineNo">180</span>import java.awt.Color;<a name="line.180"></a>
  189. <span class="sourceLineNo">181</span>import java.awt.Composite;<a name="line.181"></a>
  190. <span class="sourceLineNo">182</span>import java.awt.Font;<a name="line.182"></a>
  191. <span class="sourceLineNo">183</span>import java.awt.FontMetrics;<a name="line.183"></a>
  192. <span class="sourceLineNo">184</span>import java.awt.Graphics2D;<a name="line.184"></a>
  193. <span class="sourceLineNo">185</span>import java.awt.Paint;<a name="line.185"></a>
  194. <span class="sourceLineNo">186</span>import java.awt.RadialGradientPaint;<a name="line.186"></a>
  195. <span class="sourceLineNo">187</span>import java.awt.Shape;<a name="line.187"></a>
  196. <span class="sourceLineNo">188</span>import java.awt.Stroke;<a name="line.188"></a>
  197. <span class="sourceLineNo">189</span>import java.awt.geom.Arc2D;<a name="line.189"></a>
  198. <span class="sourceLineNo">190</span>import java.awt.geom.CubicCurve2D;<a name="line.190"></a>
  199. <span class="sourceLineNo">191</span>import java.awt.geom.Ellipse2D;<a name="line.191"></a>
  200. <span class="sourceLineNo">192</span>import java.awt.geom.Line2D;<a name="line.192"></a>
  201. <span class="sourceLineNo">193</span>import java.awt.geom.Point2D;<a name="line.193"></a>
  202. <span class="sourceLineNo">194</span>import java.awt.geom.QuadCurve2D;<a name="line.194"></a>
  203. <span class="sourceLineNo">195</span>import java.awt.geom.Rectangle2D;<a name="line.195"></a>
  204. <span class="sourceLineNo">196</span>import java.awt.image.BufferedImage;<a name="line.196"></a>
  205. <span class="sourceLineNo">197</span>import java.io.IOException;<a name="line.197"></a>
  206. <span class="sourceLineNo">198</span>import java.io.ObjectInputStream;<a name="line.198"></a>
  207. <span class="sourceLineNo">199</span>import java.io.ObjectOutputStream;<a name="line.199"></a>
  208. <span class="sourceLineNo">200</span>import java.io.Serializable;<a name="line.200"></a>
  209. <span class="sourceLineNo">201</span>import java.util.Iterator;<a name="line.201"></a>
  210. <span class="sourceLineNo">202</span>import java.util.List;<a name="line.202"></a>
  211. <span class="sourceLineNo">203</span>import java.util.Map;<a name="line.203"></a>
  212. <span class="sourceLineNo">204</span>import java.util.ResourceBundle;<a name="line.204"></a>
  213. <span class="sourceLineNo">205</span>import java.util.TreeMap;<a name="line.205"></a>
  214. <span class="sourceLineNo">206</span>import org.jfree.chart.JFreeChart;<a name="line.206"></a>
  215. <span class="sourceLineNo">207</span><a name="line.207"></a>
  216. <span class="sourceLineNo">208</span>import org.jfree.chart.LegendItem;<a name="line.208"></a>
  217. <span class="sourceLineNo">209</span>import org.jfree.chart.LegendItemCollection;<a name="line.209"></a>
  218. <span class="sourceLineNo">210</span>import org.jfree.chart.PaintMap;<a name="line.210"></a>
  219. <span class="sourceLineNo">211</span>import org.jfree.chart.StrokeMap;<a name="line.211"></a>
  220. <span class="sourceLineNo">212</span>import org.jfree.chart.entity.EntityCollection;<a name="line.212"></a>
  221. <span class="sourceLineNo">213</span>import org.jfree.chart.entity.PieSectionEntity;<a name="line.213"></a>
  222. <span class="sourceLineNo">214</span>import org.jfree.chart.event.PlotChangeEvent;<a name="line.214"></a>
  223. <span class="sourceLineNo">215</span>import org.jfree.chart.labels.PieSectionLabelGenerator;<a name="line.215"></a>
  224. <span class="sourceLineNo">216</span>import org.jfree.chart.labels.PieToolTipGenerator;<a name="line.216"></a>
  225. <span class="sourceLineNo">217</span>import org.jfree.chart.labels.StandardPieSectionLabelGenerator;<a name="line.217"></a>
  226. <span class="sourceLineNo">218</span>import org.jfree.chart.urls.PieURLGenerator;<a name="line.218"></a>
  227. <span class="sourceLineNo">219</span>import org.jfree.chart.util.ParamChecks;<a name="line.219"></a>
  228. <span class="sourceLineNo">220</span>import org.jfree.chart.util.ResourceBundleWrapper;<a name="line.220"></a>
  229. <span class="sourceLineNo">221</span>import org.jfree.chart.util.ShadowGenerator;<a name="line.221"></a>
  230. <span class="sourceLineNo">222</span>import org.jfree.data.DefaultKeyedValues;<a name="line.222"></a>
  231. <span class="sourceLineNo">223</span>import org.jfree.data.KeyedValues;<a name="line.223"></a>
  232. <span class="sourceLineNo">224</span>import org.jfree.data.general.DatasetChangeEvent;<a name="line.224"></a>
  233. <span class="sourceLineNo">225</span>import org.jfree.data.general.DatasetUtilities;<a name="line.225"></a>
  234. <span class="sourceLineNo">226</span>import org.jfree.data.general.PieDataset;<a name="line.226"></a>
  235. <span class="sourceLineNo">227</span>import org.jfree.io.SerialUtilities;<a name="line.227"></a>
  236. <span class="sourceLineNo">228</span>import org.jfree.text.G2TextMeasurer;<a name="line.228"></a>
  237. <span class="sourceLineNo">229</span>import org.jfree.text.TextBlock;<a name="line.229"></a>
  238. <span class="sourceLineNo">230</span>import org.jfree.text.TextBox;<a name="line.230"></a>
  239. <span class="sourceLineNo">231</span>import org.jfree.text.TextUtilities;<a name="line.231"></a>
  240. <span class="sourceLineNo">232</span>import org.jfree.ui.RectangleAnchor;<a name="line.232"></a>
  241. <span class="sourceLineNo">233</span>import org.jfree.ui.RectangleInsets;<a name="line.233"></a>
  242. <span class="sourceLineNo">234</span>import org.jfree.ui.TextAnchor;<a name="line.234"></a>
  243. <span class="sourceLineNo">235</span>import org.jfree.util.ObjectUtilities;<a name="line.235"></a>
  244. <span class="sourceLineNo">236</span>import org.jfree.util.PaintUtilities;<a name="line.236"></a>
  245. <span class="sourceLineNo">237</span>import org.jfree.util.PublicCloneable;<a name="line.237"></a>
  246. <span class="sourceLineNo">238</span>import org.jfree.util.Rotation;<a name="line.238"></a>
  247. <span class="sourceLineNo">239</span>import org.jfree.util.ShapeUtilities;<a name="line.239"></a>
  248. <span class="sourceLineNo">240</span>import org.jfree.util.UnitType;<a name="line.240"></a>
  249. <span class="sourceLineNo">241</span><a name="line.241"></a>
  250. <span class="sourceLineNo">242</span>/**<a name="line.242"></a>
  251. <span class="sourceLineNo">243</span> * A plot that displays data in the form of a pie chart, using data from any<a name="line.243"></a>
  252. <span class="sourceLineNo">244</span> * class that implements the {@link PieDataset} interface.<a name="line.244"></a>
  253. <span class="sourceLineNo">245</span> * The example shown here is generated by the &lt;code&gt;PieChartDemo2.java&lt;/code&gt;<a name="line.245"></a>
  254. <span class="sourceLineNo">246</span> * program included in the JFreeChart Demo Collection:<a name="line.246"></a>
  255. <span class="sourceLineNo">247</span> * &lt;br&gt;&lt;br&gt;<a name="line.247"></a>
  256. <span class="sourceLineNo">248</span> * &lt;img src="../../../../images/PiePlotSample.png" alt="PiePlotSample.png"&gt;<a name="line.248"></a>
  257. <span class="sourceLineNo">249</span> * &lt;P&gt;<a name="line.249"></a>
  258. <span class="sourceLineNo">250</span> * Special notes:<a name="line.250"></a>
  259. <span class="sourceLineNo">251</span> * &lt;ol&gt;<a name="line.251"></a>
  260. <span class="sourceLineNo">252</span> * &lt;li&gt;the default starting point is 12 o'clock and the pie sections proceed<a name="line.252"></a>
  261. <span class="sourceLineNo">253</span> * in a clockwise direction, but these settings can be changed;&lt;/li&gt;<a name="line.253"></a>
  262. <span class="sourceLineNo">254</span> * &lt;li&gt;negative values in the dataset are ignored;&lt;/li&gt;<a name="line.254"></a>
  263. <span class="sourceLineNo">255</span> * &lt;li&gt;there are utility methods for creating a {@link PieDataset} from a<a name="line.255"></a>
  264. <span class="sourceLineNo">256</span> * {@link org.jfree.data.category.CategoryDataset};&lt;/li&gt;<a name="line.256"></a>
  265. <span class="sourceLineNo">257</span> * &lt;/ol&gt;<a name="line.257"></a>
  266. <span class="sourceLineNo">258</span> *<a name="line.258"></a>
  267. <span class="sourceLineNo">259</span> * @see Plot<a name="line.259"></a>
  268. <span class="sourceLineNo">260</span> * @see PieDataset<a name="line.260"></a>
  269. <span class="sourceLineNo">261</span> */<a name="line.261"></a>
  270. <span class="sourceLineNo">262</span>public class PiePlot extends Plot implements Cloneable, Serializable {<a name="line.262"></a>
  271. <span class="sourceLineNo">263</span><a name="line.263"></a>
  272. <span class="sourceLineNo">264</span> /** For serialization. */<a name="line.264"></a>
  273. <span class="sourceLineNo">265</span> private static final long serialVersionUID = -795612466005590431L;<a name="line.265"></a>
  274. <span class="sourceLineNo">266</span><a name="line.266"></a>
  275. <span class="sourceLineNo">267</span> /** The default interior gap. */<a name="line.267"></a>
  276. <span class="sourceLineNo">268</span> public static final double DEFAULT_INTERIOR_GAP = 0.08;<a name="line.268"></a>
  277. <span class="sourceLineNo">269</span><a name="line.269"></a>
  278. <span class="sourceLineNo">270</span> /** The maximum interior gap (currently 40%). */<a name="line.270"></a>
  279. <span class="sourceLineNo">271</span> public static final double MAX_INTERIOR_GAP = 0.40;<a name="line.271"></a>
  280. <span class="sourceLineNo">272</span><a name="line.272"></a>
  281. <span class="sourceLineNo">273</span> /** The default starting angle for the pie chart. */<a name="line.273"></a>
  282. <span class="sourceLineNo">274</span> public static final double DEFAULT_START_ANGLE = 90.0;<a name="line.274"></a>
  283. <span class="sourceLineNo">275</span><a name="line.275"></a>
  284. <span class="sourceLineNo">276</span> /** The default section label font. */<a name="line.276"></a>
  285. <span class="sourceLineNo">277</span> public static final Font DEFAULT_LABEL_FONT = new Font("SansSerif",<a name="line.277"></a>
  286. <span class="sourceLineNo">278</span> Font.PLAIN, 10);<a name="line.278"></a>
  287. <span class="sourceLineNo">279</span><a name="line.279"></a>
  288. <span class="sourceLineNo">280</span> /** The default section label paint. */<a name="line.280"></a>
  289. <span class="sourceLineNo">281</span> public static final Paint DEFAULT_LABEL_PAINT = Color.black;<a name="line.281"></a>
  290. <span class="sourceLineNo">282</span><a name="line.282"></a>
  291. <span class="sourceLineNo">283</span> /** The default section label background paint. */<a name="line.283"></a>
  292. <span class="sourceLineNo">284</span> public static final Paint DEFAULT_LABEL_BACKGROUND_PAINT = new Color(255,<a name="line.284"></a>
  293. <span class="sourceLineNo">285</span> 255, 192);<a name="line.285"></a>
  294. <span class="sourceLineNo">286</span><a name="line.286"></a>
  295. <span class="sourceLineNo">287</span> /** The default section label outline paint. */<a name="line.287"></a>
  296. <span class="sourceLineNo">288</span> public static final Paint DEFAULT_LABEL_OUTLINE_PAINT = Color.black;<a name="line.288"></a>
  297. <span class="sourceLineNo">289</span><a name="line.289"></a>
  298. <span class="sourceLineNo">290</span> /** The default section label outline stroke. */<a name="line.290"></a>
  299. <span class="sourceLineNo">291</span> public static final Stroke DEFAULT_LABEL_OUTLINE_STROKE = new BasicStroke(<a name="line.291"></a>
  300. <span class="sourceLineNo">292</span> 0.5f);<a name="line.292"></a>
  301. <span class="sourceLineNo">293</span><a name="line.293"></a>
  302. <span class="sourceLineNo">294</span> /** The default section label shadow paint. */<a name="line.294"></a>
  303. <span class="sourceLineNo">295</span> public static final Paint DEFAULT_LABEL_SHADOW_PAINT = new Color(151, 151,<a name="line.295"></a>
  304. <span class="sourceLineNo">296</span> 151, 128);<a name="line.296"></a>
  305. <span class="sourceLineNo">297</span><a name="line.297"></a>
  306. <span class="sourceLineNo">298</span> /** The default minimum arc angle to draw. */<a name="line.298"></a>
  307. <span class="sourceLineNo">299</span> public static final double DEFAULT_MINIMUM_ARC_ANGLE_TO_DRAW = 0.00001;<a name="line.299"></a>
  308. <span class="sourceLineNo">300</span><a name="line.300"></a>
  309. <span class="sourceLineNo">301</span> /** The dataset for the pie chart. */<a name="line.301"></a>
  310. <span class="sourceLineNo">302</span> private PieDataset dataset;<a name="line.302"></a>
  311. <span class="sourceLineNo">303</span><a name="line.303"></a>
  312. <span class="sourceLineNo">304</span> /** The pie index (used by the {@link MultiplePiePlot} class). */<a name="line.304"></a>
  313. <span class="sourceLineNo">305</span> private int pieIndex;<a name="line.305"></a>
  314. <span class="sourceLineNo">306</span><a name="line.306"></a>
  315. <span class="sourceLineNo">307</span> /**<a name="line.307"></a>
  316. <span class="sourceLineNo">308</span> * The amount of space left around the outside of the pie plot, expressed<a name="line.308"></a>
  317. <span class="sourceLineNo">309</span> * as a percentage of the plot area width and height.<a name="line.309"></a>
  318. <span class="sourceLineNo">310</span> */<a name="line.310"></a>
  319. <span class="sourceLineNo">311</span> private double interiorGap;<a name="line.311"></a>
  320. <span class="sourceLineNo">312</span><a name="line.312"></a>
  321. <span class="sourceLineNo">313</span> /** Flag determining whether to draw an ellipse or a perfect circle. */<a name="line.313"></a>
  322. <span class="sourceLineNo">314</span> private boolean circular;<a name="line.314"></a>
  323. <span class="sourceLineNo">315</span><a name="line.315"></a>
  324. <span class="sourceLineNo">316</span> /** The starting angle. */<a name="line.316"></a>
  325. <span class="sourceLineNo">317</span> private double startAngle;<a name="line.317"></a>
  326. <span class="sourceLineNo">318</span><a name="line.318"></a>
  327. <span class="sourceLineNo">319</span> /** The direction for the pie segments. */<a name="line.319"></a>
  328. <span class="sourceLineNo">320</span> private Rotation direction;<a name="line.320"></a>
  329. <span class="sourceLineNo">321</span><a name="line.321"></a>
  330. <span class="sourceLineNo">322</span> /** The section paint map. */<a name="line.322"></a>
  331. <span class="sourceLineNo">323</span> private PaintMap sectionPaintMap;<a name="line.323"></a>
  332. <span class="sourceLineNo">324</span><a name="line.324"></a>
  333. <span class="sourceLineNo">325</span> /** The base section paint (fallback). */<a name="line.325"></a>
  334. <span class="sourceLineNo">326</span> private transient Paint baseSectionPaint;<a name="line.326"></a>
  335. <span class="sourceLineNo">327</span><a name="line.327"></a>
  336. <span class="sourceLineNo">328</span> /**<a name="line.328"></a>
  337. <span class="sourceLineNo">329</span> * A flag that controls whether or not the section paint is auto-populated<a name="line.329"></a>
  338. <span class="sourceLineNo">330</span> * from the drawing supplier.<a name="line.330"></a>
  339. <span class="sourceLineNo">331</span> *<a name="line.331"></a>
  340. <span class="sourceLineNo">332</span> * @since 1.0.11<a name="line.332"></a>
  341. <span class="sourceLineNo">333</span> */<a name="line.333"></a>
  342. <span class="sourceLineNo">334</span> private boolean autoPopulateSectionPaint;<a name="line.334"></a>
  343. <span class="sourceLineNo">335</span><a name="line.335"></a>
  344. <span class="sourceLineNo">336</span> /**<a name="line.336"></a>
  345. <span class="sourceLineNo">337</span> * A flag that controls whether or not an outline is drawn for each<a name="line.337"></a>
  346. <span class="sourceLineNo">338</span> * section in the plot.<a name="line.338"></a>
  347. <span class="sourceLineNo">339</span> */<a name="line.339"></a>
  348. <span class="sourceLineNo">340</span> private boolean sectionOutlinesVisible;<a name="line.340"></a>
  349. <span class="sourceLineNo">341</span><a name="line.341"></a>
  350. <span class="sourceLineNo">342</span> /** The section outline paint map. */<a name="line.342"></a>
  351. <span class="sourceLineNo">343</span> private PaintMap sectionOutlinePaintMap;<a name="line.343"></a>
  352. <span class="sourceLineNo">344</span><a name="line.344"></a>
  353. <span class="sourceLineNo">345</span> /** The base section outline paint (fallback). */<a name="line.345"></a>
  354. <span class="sourceLineNo">346</span> private transient Paint baseSectionOutlinePaint;<a name="line.346"></a>
  355. <span class="sourceLineNo">347</span><a name="line.347"></a>
  356. <span class="sourceLineNo">348</span> /**<a name="line.348"></a>
  357. <span class="sourceLineNo">349</span> * A flag that controls whether or not the section outline paint is<a name="line.349"></a>
  358. <span class="sourceLineNo">350</span> * auto-populated from the drawing supplier.<a name="line.350"></a>
  359. <span class="sourceLineNo">351</span> *<a name="line.351"></a>
  360. <span class="sourceLineNo">352</span> * @since 1.0.11<a name="line.352"></a>
  361. <span class="sourceLineNo">353</span> */<a name="line.353"></a>
  362. <span class="sourceLineNo">354</span> private boolean autoPopulateSectionOutlinePaint;<a name="line.354"></a>
  363. <span class="sourceLineNo">355</span><a name="line.355"></a>
  364. <span class="sourceLineNo">356</span> /** The section outline stroke map. */<a name="line.356"></a>
  365. <span class="sourceLineNo">357</span> private StrokeMap sectionOutlineStrokeMap;<a name="line.357"></a>
  366. <span class="sourceLineNo">358</span><a name="line.358"></a>
  367. <span class="sourceLineNo">359</span> /** The base section outline stroke (fallback). */<a name="line.359"></a>
  368. <span class="sourceLineNo">360</span> private transient Stroke baseSectionOutlineStroke;<a name="line.360"></a>
  369. <span class="sourceLineNo">361</span><a name="line.361"></a>
  370. <span class="sourceLineNo">362</span> /**<a name="line.362"></a>
  371. <span class="sourceLineNo">363</span> * A flag that controls whether or not the section outline stroke is<a name="line.363"></a>
  372. <span class="sourceLineNo">364</span> * auto-populated from the drawing supplier.<a name="line.364"></a>
  373. <span class="sourceLineNo">365</span> *<a name="line.365"></a>
  374. <span class="sourceLineNo">366</span> * @since 1.0.11<a name="line.366"></a>
  375. <span class="sourceLineNo">367</span> */<a name="line.367"></a>
  376. <span class="sourceLineNo">368</span> private boolean autoPopulateSectionOutlineStroke;<a name="line.368"></a>
  377. <span class="sourceLineNo">369</span><a name="line.369"></a>
  378. <span class="sourceLineNo">370</span> /** The shadow paint. */<a name="line.370"></a>
  379. <span class="sourceLineNo">371</span> private transient Paint shadowPaint = Color.gray;<a name="line.371"></a>
  380. <span class="sourceLineNo">372</span><a name="line.372"></a>
  381. <span class="sourceLineNo">373</span> /** The x-offset for the shadow effect. */<a name="line.373"></a>
  382. <span class="sourceLineNo">374</span> private double shadowXOffset = 4.0f;<a name="line.374"></a>
  383. <span class="sourceLineNo">375</span><a name="line.375"></a>
  384. <span class="sourceLineNo">376</span> /** The y-offset for the shadow effect. */<a name="line.376"></a>
  385. <span class="sourceLineNo">377</span> private double shadowYOffset = 4.0f;<a name="line.377"></a>
  386. <span class="sourceLineNo">378</span><a name="line.378"></a>
  387. <span class="sourceLineNo">379</span> /** The percentage amount to explode each pie section. */<a name="line.379"></a>
  388. <span class="sourceLineNo">380</span> private Map explodePercentages;<a name="line.380"></a>
  389. <span class="sourceLineNo">381</span><a name="line.381"></a>
  390. <span class="sourceLineNo">382</span> /** The section label generator. */<a name="line.382"></a>
  391. <span class="sourceLineNo">383</span> private PieSectionLabelGenerator labelGenerator;<a name="line.383"></a>
  392. <span class="sourceLineNo">384</span><a name="line.384"></a>
  393. <span class="sourceLineNo">385</span> /** The font used to display the section labels. */<a name="line.385"></a>
  394. <span class="sourceLineNo">386</span> private Font labelFont;<a name="line.386"></a>
  395. <span class="sourceLineNo">387</span><a name="line.387"></a>
  396. <span class="sourceLineNo">388</span> /** The color used to draw the section labels. */<a name="line.388"></a>
  397. <span class="sourceLineNo">389</span> private transient Paint labelPaint;<a name="line.389"></a>
  398. <span class="sourceLineNo">390</span><a name="line.390"></a>
  399. <span class="sourceLineNo">391</span> /**<a name="line.391"></a>
  400. <span class="sourceLineNo">392</span> * The color used to draw the background of the section labels. If this<a name="line.392"></a>
  401. <span class="sourceLineNo">393</span> * is &lt;code&gt;null&lt;/code&gt;, the background is not filled.<a name="line.393"></a>
  402. <span class="sourceLineNo">394</span> */<a name="line.394"></a>
  403. <span class="sourceLineNo">395</span> private transient Paint labelBackgroundPaint;<a name="line.395"></a>
  404. <span class="sourceLineNo">396</span><a name="line.396"></a>
  405. <span class="sourceLineNo">397</span> /**<a name="line.397"></a>
  406. <span class="sourceLineNo">398</span> * The paint used to draw the outline of the section labels<a name="line.398"></a>
  407. <span class="sourceLineNo">399</span> * (&lt;code&gt;null&lt;/code&gt; permitted).<a name="line.399"></a>
  408. <span class="sourceLineNo">400</span> */<a name="line.400"></a>
  409. <span class="sourceLineNo">401</span> private transient Paint labelOutlinePaint;<a name="line.401"></a>
  410. <span class="sourceLineNo">402</span><a name="line.402"></a>
  411. <span class="sourceLineNo">403</span> /**<a name="line.403"></a>
  412. <span class="sourceLineNo">404</span> * The stroke used to draw the outline of the section labels<a name="line.404"></a>
  413. <span class="sourceLineNo">405</span> * (&lt;code&gt;null&lt;/code&gt; permitted).<a name="line.405"></a>
  414. <span class="sourceLineNo">406</span> */<a name="line.406"></a>
  415. <span class="sourceLineNo">407</span> private transient Stroke labelOutlineStroke;<a name="line.407"></a>
  416. <span class="sourceLineNo">408</span><a name="line.408"></a>
  417. <span class="sourceLineNo">409</span> /**<a name="line.409"></a>
  418. <span class="sourceLineNo">410</span> * The paint used to draw the shadow for the section labels<a name="line.410"></a>
  419. <span class="sourceLineNo">411</span> * (&lt;code&gt;null&lt;/code&gt; permitted).<a name="line.411"></a>
  420. <span class="sourceLineNo">412</span> */<a name="line.412"></a>
  421. <span class="sourceLineNo">413</span> private transient Paint labelShadowPaint;<a name="line.413"></a>
  422. <span class="sourceLineNo">414</span><a name="line.414"></a>
  423. <span class="sourceLineNo">415</span> /**<a name="line.415"></a>
  424. <span class="sourceLineNo">416</span> * A flag that controls whether simple or extended labels are used.<a name="line.416"></a>
  425. <span class="sourceLineNo">417</span> *<a name="line.417"></a>
  426. <span class="sourceLineNo">418</span> * @since 1.0.7<a name="line.418"></a>
  427. <span class="sourceLineNo">419</span> */<a name="line.419"></a>
  428. <span class="sourceLineNo">420</span> private boolean simpleLabels = true;<a name="line.420"></a>
  429. <span class="sourceLineNo">421</span><a name="line.421"></a>
  430. <span class="sourceLineNo">422</span> /**<a name="line.422"></a>
  431. <span class="sourceLineNo">423</span> * The padding between the labels and the label outlines. This is not<a name="line.423"></a>
  432. <span class="sourceLineNo">424</span> * allowed to be &lt;code&gt;null&lt;/code&gt;.<a name="line.424"></a>
  433. <span class="sourceLineNo">425</span> *<a name="line.425"></a>
  434. <span class="sourceLineNo">426</span> * @since 1.0.7<a name="line.426"></a>
  435. <span class="sourceLineNo">427</span> */<a name="line.427"></a>
  436. <span class="sourceLineNo">428</span> private RectangleInsets labelPadding;<a name="line.428"></a>
  437. <span class="sourceLineNo">429</span><a name="line.429"></a>
  438. <span class="sourceLineNo">430</span> /**<a name="line.430"></a>
  439. <span class="sourceLineNo">431</span> * The simple label offset.<a name="line.431"></a>
  440. <span class="sourceLineNo">432</span> *<a name="line.432"></a>
  441. <span class="sourceLineNo">433</span> * @since 1.0.7<a name="line.433"></a>
  442. <span class="sourceLineNo">434</span> */<a name="line.434"></a>
  443. <span class="sourceLineNo">435</span> private RectangleInsets simpleLabelOffset;<a name="line.435"></a>
  444. <span class="sourceLineNo">436</span><a name="line.436"></a>
  445. <span class="sourceLineNo">437</span> /** The maximum label width as a percentage of the plot width. */<a name="line.437"></a>
  446. <span class="sourceLineNo">438</span> private double maximumLabelWidth = 0.14;<a name="line.438"></a>
  447. <span class="sourceLineNo">439</span><a name="line.439"></a>
  448. <span class="sourceLineNo">440</span> /**<a name="line.440"></a>
  449. <span class="sourceLineNo">441</span> * The gap between the labels and the link corner, as a percentage of the<a name="line.441"></a>
  450. <span class="sourceLineNo">442</span> * plot width.<a name="line.442"></a>
  451. <span class="sourceLineNo">443</span> */<a name="line.443"></a>
  452. <span class="sourceLineNo">444</span> private double labelGap = 0.025;<a name="line.444"></a>
  453. <span class="sourceLineNo">445</span><a name="line.445"></a>
  454. <span class="sourceLineNo">446</span> /** A flag that controls whether or not the label links are drawn. */<a name="line.446"></a>
  455. <span class="sourceLineNo">447</span> private boolean labelLinksVisible;<a name="line.447"></a>
  456. <span class="sourceLineNo">448</span><a name="line.448"></a>
  457. <span class="sourceLineNo">449</span> /**<a name="line.449"></a>
  458. <span class="sourceLineNo">450</span> * The label link style.<a name="line.450"></a>
  459. <span class="sourceLineNo">451</span> *<a name="line.451"></a>
  460. <span class="sourceLineNo">452</span> * @since 1.0.10<a name="line.452"></a>
  461. <span class="sourceLineNo">453</span> */<a name="line.453"></a>
  462. <span class="sourceLineNo">454</span> private PieLabelLinkStyle labelLinkStyle = PieLabelLinkStyle.STANDARD;<a name="line.454"></a>
  463. <span class="sourceLineNo">455</span><a name="line.455"></a>
  464. <span class="sourceLineNo">456</span> /** The link margin. */<a name="line.456"></a>
  465. <span class="sourceLineNo">457</span> private double labelLinkMargin = 0.025;<a name="line.457"></a>
  466. <span class="sourceLineNo">458</span><a name="line.458"></a>
  467. <span class="sourceLineNo">459</span> /** The paint used for the label linking lines. */<a name="line.459"></a>
  468. <span class="sourceLineNo">460</span> private transient Paint labelLinkPaint = Color.black;<a name="line.460"></a>
  469. <span class="sourceLineNo">461</span><a name="line.461"></a>
  470. <span class="sourceLineNo">462</span> /** The stroke used for the label linking lines. */<a name="line.462"></a>
  471. <span class="sourceLineNo">463</span> private transient Stroke labelLinkStroke = new BasicStroke(0.5f);<a name="line.463"></a>
  472. <span class="sourceLineNo">464</span><a name="line.464"></a>
  473. <span class="sourceLineNo">465</span> /**<a name="line.465"></a>
  474. <span class="sourceLineNo">466</span> * The pie section label distributor.<a name="line.466"></a>
  475. <span class="sourceLineNo">467</span> *<a name="line.467"></a>
  476. <span class="sourceLineNo">468</span> * @since 1.0.6<a name="line.468"></a>
  477. <span class="sourceLineNo">469</span> */<a name="line.469"></a>
  478. <span class="sourceLineNo">470</span> private AbstractPieLabelDistributor labelDistributor;<a name="line.470"></a>
  479. <span class="sourceLineNo">471</span><a name="line.471"></a>
  480. <span class="sourceLineNo">472</span> /** The tooltip generator. */<a name="line.472"></a>
  481. <span class="sourceLineNo">473</span> private PieToolTipGenerator toolTipGenerator;<a name="line.473"></a>
  482. <span class="sourceLineNo">474</span><a name="line.474"></a>
  483. <span class="sourceLineNo">475</span> /** The URL generator. */<a name="line.475"></a>
  484. <span class="sourceLineNo">476</span> private PieURLGenerator urlGenerator;<a name="line.476"></a>
  485. <span class="sourceLineNo">477</span><a name="line.477"></a>
  486. <span class="sourceLineNo">478</span> /** The legend label generator. */<a name="line.478"></a>
  487. <span class="sourceLineNo">479</span> private PieSectionLabelGenerator legendLabelGenerator;<a name="line.479"></a>
  488. <span class="sourceLineNo">480</span><a name="line.480"></a>
  489. <span class="sourceLineNo">481</span> /** A tool tip generator for the legend. */<a name="line.481"></a>
  490. <span class="sourceLineNo">482</span> private PieSectionLabelGenerator legendLabelToolTipGenerator;<a name="line.482"></a>
  491. <span class="sourceLineNo">483</span><a name="line.483"></a>
  492. <span class="sourceLineNo">484</span> /**<a name="line.484"></a>
  493. <span class="sourceLineNo">485</span> * A URL generator for the legend items (optional).<a name="line.485"></a>
  494. <span class="sourceLineNo">486</span> *<a name="line.486"></a>
  495. <span class="sourceLineNo">487</span> * @since 1.0.4.<a name="line.487"></a>
  496. <span class="sourceLineNo">488</span> */<a name="line.488"></a>
  497. <span class="sourceLineNo">489</span> private PieURLGenerator legendLabelURLGenerator;<a name="line.489"></a>
  498. <span class="sourceLineNo">490</span><a name="line.490"></a>
  499. <span class="sourceLineNo">491</span> /**<a name="line.491"></a>
  500. <span class="sourceLineNo">492</span> * A flag that controls whether &lt;code&gt;null&lt;/code&gt; values are ignored.<a name="line.492"></a>
  501. <span class="sourceLineNo">493</span> */<a name="line.493"></a>
  502. <span class="sourceLineNo">494</span> private boolean ignoreNullValues;<a name="line.494"></a>
  503. <span class="sourceLineNo">495</span><a name="line.495"></a>
  504. <span class="sourceLineNo">496</span> /**<a name="line.496"></a>
  505. <span class="sourceLineNo">497</span> * A flag that controls whether zero values are ignored.<a name="line.497"></a>
  506. <span class="sourceLineNo">498</span> */<a name="line.498"></a>
  507. <span class="sourceLineNo">499</span> private boolean ignoreZeroValues;<a name="line.499"></a>
  508. <span class="sourceLineNo">500</span><a name="line.500"></a>
  509. <span class="sourceLineNo">501</span> /** The legend item shape. */<a name="line.501"></a>
  510. <span class="sourceLineNo">502</span> private transient Shape legendItemShape;<a name="line.502"></a>
  511. <span class="sourceLineNo">503</span><a name="line.503"></a>
  512. <span class="sourceLineNo">504</span> /**<a name="line.504"></a>
  513. <span class="sourceLineNo">505</span> * The smallest arc angle that will get drawn (this is to avoid a bug in<a name="line.505"></a>
  514. <span class="sourceLineNo">506</span> * various Java implementations that causes the JVM to crash). See this<a name="line.506"></a>
  515. <span class="sourceLineNo">507</span> * link for details:<a name="line.507"></a>
  516. <span class="sourceLineNo">508</span> *<a name="line.508"></a>
  517. <span class="sourceLineNo">509</span> * http://www.jfree.org/phpBB2/viewtopic.php?t=2707<a name="line.509"></a>
  518. <span class="sourceLineNo">510</span> *<a name="line.510"></a>
  519. <span class="sourceLineNo">511</span> * ...and this bug report in the Java Bug Parade:<a name="line.511"></a>
  520. <span class="sourceLineNo">512</span> *<a name="line.512"></a>
  521. <span class="sourceLineNo">513</span> * http://developer.java.sun.com/developer/bugParade/bugs/4836495.html<a name="line.513"></a>
  522. <span class="sourceLineNo">514</span> */<a name="line.514"></a>
  523. <span class="sourceLineNo">515</span> private double minimumArcAngleToDraw;<a name="line.515"></a>
  524. <span class="sourceLineNo">516</span><a name="line.516"></a>
  525. <span class="sourceLineNo">517</span> /**<a name="line.517"></a>
  526. <span class="sourceLineNo">518</span> * The shadow generator for the plot (&lt;code&gt;null&lt;/code&gt; permitted).<a name="line.518"></a>
  527. <span class="sourceLineNo">519</span> * <a name="line.519"></a>
  528. <span class="sourceLineNo">520</span> * @since 1.0.14<a name="line.520"></a>
  529. <span class="sourceLineNo">521</span> */<a name="line.521"></a>
  530. <span class="sourceLineNo">522</span> private ShadowGenerator shadowGenerator;<a name="line.522"></a>
  531. <span class="sourceLineNo">523</span><a name="line.523"></a>
  532. <span class="sourceLineNo">524</span> /** The resourceBundle for the localization. */<a name="line.524"></a>
  533. <span class="sourceLineNo">525</span> protected static ResourceBundle localizationResources<a name="line.525"></a>
  534. <span class="sourceLineNo">526</span> = ResourceBundleWrapper.getBundle(<a name="line.526"></a>
  535. <span class="sourceLineNo">527</span> "org.jfree.chart.plot.LocalizationBundle");<a name="line.527"></a>
  536. <span class="sourceLineNo">528</span><a name="line.528"></a>
  537. <span class="sourceLineNo">529</span> /**<a name="line.529"></a>
  538. <span class="sourceLineNo">530</span> * This debug flag controls whether or not an outline is drawn showing the<a name="line.530"></a>
  539. <span class="sourceLineNo">531</span> * interior of the plot region. This is drawn as a lightGray rectangle<a name="line.531"></a>
  540. <span class="sourceLineNo">532</span> * showing the padding provided by the 'interiorGap' setting.<a name="line.532"></a>
  541. <span class="sourceLineNo">533</span> */<a name="line.533"></a>
  542. <span class="sourceLineNo">534</span> static final boolean DEBUG_DRAW_INTERIOR = false;<a name="line.534"></a>
  543. <span class="sourceLineNo">535</span><a name="line.535"></a>
  544. <span class="sourceLineNo">536</span> /**<a name="line.536"></a>
  545. <span class="sourceLineNo">537</span> * This debug flag controls whether or not an outline is drawn showing the<a name="line.537"></a>
  546. <span class="sourceLineNo">538</span> * link area (in blue) and link ellipse (in yellow). This controls where<a name="line.538"></a>
  547. <span class="sourceLineNo">539</span> * the label links have 'elbow' points.<a name="line.539"></a>
  548. <span class="sourceLineNo">540</span> */<a name="line.540"></a>
  549. <span class="sourceLineNo">541</span> static final boolean DEBUG_DRAW_LINK_AREA = false;<a name="line.541"></a>
  550. <span class="sourceLineNo">542</span><a name="line.542"></a>
  551. <span class="sourceLineNo">543</span> /**<a name="line.543"></a>
  552. <span class="sourceLineNo">544</span> * This debug flag controls whether or not an outline is drawn showing<a name="line.544"></a>
  553. <span class="sourceLineNo">545</span> * the pie area (in green).<a name="line.545"></a>
  554. <span class="sourceLineNo">546</span> */<a name="line.546"></a>
  555. <span class="sourceLineNo">547</span> static final boolean DEBUG_DRAW_PIE_AREA = false;<a name="line.547"></a>
  556. <span class="sourceLineNo">548</span><a name="line.548"></a>
  557. <span class="sourceLineNo">549</span> /**<a name="line.549"></a>
  558. <span class="sourceLineNo">550</span> * Creates a new plot. The dataset is initially set to &lt;code&gt;null&lt;/code&gt;.<a name="line.550"></a>
  559. <span class="sourceLineNo">551</span> */<a name="line.551"></a>
  560. <span class="sourceLineNo">552</span> public PiePlot() {<a name="line.552"></a>
  561. <span class="sourceLineNo">553</span> this(null);<a name="line.553"></a>
  562. <span class="sourceLineNo">554</span> }<a name="line.554"></a>
  563. <span class="sourceLineNo">555</span><a name="line.555"></a>
  564. <span class="sourceLineNo">556</span> /**<a name="line.556"></a>
  565. <span class="sourceLineNo">557</span> * Creates a plot that will draw a pie chart for the specified dataset.<a name="line.557"></a>
  566. <span class="sourceLineNo">558</span> *<a name="line.558"></a>
  567. <span class="sourceLineNo">559</span> * @param dataset the dataset (&lt;code&gt;null&lt;/code&gt; permitted).<a name="line.559"></a>
  568. <span class="sourceLineNo">560</span> */<a name="line.560"></a>
  569. <span class="sourceLineNo">561</span> public PiePlot(PieDataset dataset) {<a name="line.561"></a>
  570. <span class="sourceLineNo">562</span> super();<a name="line.562"></a>
  571. <span class="sourceLineNo">563</span> this.dataset = dataset;<a name="line.563"></a>
  572. <span class="sourceLineNo">564</span> if (dataset != null) {<a name="line.564"></a>
  573. <span class="sourceLineNo">565</span> dataset.addChangeListener(this);<a name="line.565"></a>
  574. <span class="sourceLineNo">566</span> }<a name="line.566"></a>
  575. <span class="sourceLineNo">567</span> this.pieIndex = 0;<a name="line.567"></a>
  576. <span class="sourceLineNo">568</span><a name="line.568"></a>
  577. <span class="sourceLineNo">569</span> this.interiorGap = DEFAULT_INTERIOR_GAP;<a name="line.569"></a>
  578. <span class="sourceLineNo">570</span> this.circular = true;<a name="line.570"></a>
  579. <span class="sourceLineNo">571</span> this.startAngle = DEFAULT_START_ANGLE;<a name="line.571"></a>
  580. <span class="sourceLineNo">572</span> this.direction = Rotation.CLOCKWISE;<a name="line.572"></a>
  581. <span class="sourceLineNo">573</span> this.minimumArcAngleToDraw = DEFAULT_MINIMUM_ARC_ANGLE_TO_DRAW;<a name="line.573"></a>
  582. <span class="sourceLineNo">574</span><a name="line.574"></a>
  583. <span class="sourceLineNo">575</span> this.sectionPaint = null;<a name="line.575"></a>
  584. <span class="sourceLineNo">576</span> this.sectionPaintMap = new PaintMap();<a name="line.576"></a>
  585. <span class="sourceLineNo">577</span> this.baseSectionPaint = Color.gray;<a name="line.577"></a>
  586. <span class="sourceLineNo">578</span> this.autoPopulateSectionPaint = true;<a name="line.578"></a>
  587. <span class="sourceLineNo">579</span><a name="line.579"></a>
  588. <span class="sourceLineNo">580</span> this.sectionOutlinesVisible = true;<a name="line.580"></a>
  589. <span class="sourceLineNo">581</span> this.sectionOutlinePaint = null;<a name="line.581"></a>
  590. <span class="sourceLineNo">582</span> this.sectionOutlinePaintMap = new PaintMap();<a name="line.582"></a>
  591. <span class="sourceLineNo">583</span> this.baseSectionOutlinePaint = DEFAULT_OUTLINE_PAINT;<a name="line.583"></a>
  592. <span class="sourceLineNo">584</span> this.autoPopulateSectionOutlinePaint = false;<a name="line.584"></a>
  593. <span class="sourceLineNo">585</span><a name="line.585"></a>
  594. <span class="sourceLineNo">586</span> this.sectionOutlineStroke = null;<a name="line.586"></a>
  595. <span class="sourceLineNo">587</span> this.sectionOutlineStrokeMap = new StrokeMap();<a name="line.587"></a>
  596. <span class="sourceLineNo">588</span> this.baseSectionOutlineStroke = DEFAULT_OUTLINE_STROKE;<a name="line.588"></a>
  597. <span class="sourceLineNo">589</span> this.autoPopulateSectionOutlineStroke = false;<a name="line.589"></a>
  598. <span class="sourceLineNo">590</span><a name="line.590"></a>
  599. <span class="sourceLineNo">591</span> this.explodePercentages = new TreeMap();<a name="line.591"></a>
  600. <span class="sourceLineNo">592</span><a name="line.592"></a>
  601. <span class="sourceLineNo">593</span> this.labelGenerator = new StandardPieSectionLabelGenerator();<a name="line.593"></a>
  602. <span class="sourceLineNo">594</span> this.labelFont = DEFAULT_LABEL_FONT;<a name="line.594"></a>
  603. <span class="sourceLineNo">595</span> this.labelPaint = DEFAULT_LABEL_PAINT;<a name="line.595"></a>
  604. <span class="sourceLineNo">596</span> this.labelBackgroundPaint = DEFAULT_LABEL_BACKGROUND_PAINT;<a name="line.596"></a>
  605. <span class="sourceLineNo">597</span> this.labelOutlinePaint = DEFAULT_LABEL_OUTLINE_PAINT;<a name="line.597"></a>
  606. <span class="sourceLineNo">598</span> this.labelOutlineStroke = DEFAULT_LABEL_OUTLINE_STROKE;<a name="line.598"></a>
  607. <span class="sourceLineNo">599</span> this.labelShadowPaint = DEFAULT_LABEL_SHADOW_PAINT;<a name="line.599"></a>
  608. <span class="sourceLineNo">600</span> this.labelLinksVisible = true;<a name="line.600"></a>
  609. <span class="sourceLineNo">601</span> this.labelDistributor = new PieLabelDistributor(0);<a name="line.601"></a>
  610. <span class="sourceLineNo">602</span><a name="line.602"></a>
  611. <span class="sourceLineNo">603</span> this.simpleLabels = false;<a name="line.603"></a>
  612. <span class="sourceLineNo">604</span> this.simpleLabelOffset = new RectangleInsets(UnitType.RELATIVE, 0.18,<a name="line.604"></a>
  613. <span class="sourceLineNo">605</span> 0.18, 0.18, 0.18);<a name="line.605"></a>
  614. <span class="sourceLineNo">606</span> this.labelPadding = new RectangleInsets(2, 2, 2, 2);<a name="line.606"></a>
  615. <span class="sourceLineNo">607</span><a name="line.607"></a>
  616. <span class="sourceLineNo">608</span> this.toolTipGenerator = null;<a name="line.608"></a>
  617. <span class="sourceLineNo">609</span> this.urlGenerator = null;<a name="line.609"></a>
  618. <span class="sourceLineNo">610</span> this.legendLabelGenerator = new StandardPieSectionLabelGenerator();<a name="line.610"></a>
  619. <span class="sourceLineNo">611</span> this.legendLabelToolTipGenerator = null;<a name="line.611"></a>
  620. <span class="sourceLineNo">612</span> this.legendLabelURLGenerator = null;<a name="line.612"></a>
  621. <span class="sourceLineNo">613</span> this.legendItemShape = Plot.DEFAULT_LEGEND_ITEM_CIRCLE;<a name="line.613"></a>
  622. <span class="sourceLineNo">614</span><a name="line.614"></a>
  623. <span class="sourceLineNo">615</span> this.ignoreNullValues = false;<a name="line.615"></a>
  624. <span class="sourceLineNo">616</span> this.ignoreZeroValues = false;<a name="line.616"></a>
  625. <span class="sourceLineNo">617</span><a name="line.617"></a>
  626. <span class="sourceLineNo">618</span> this.shadowGenerator = null;<a name="line.618"></a>
  627. <span class="sourceLineNo">619</span> }<a name="line.619"></a>
  628. <span class="sourceLineNo">620</span><a name="line.620"></a>
  629. <span class="sourceLineNo">621</span> /**<a name="line.621"></a>
  630. <span class="sourceLineNo">622</span> * Returns the dataset.<a name="line.622"></a>
  631. <span class="sourceLineNo">623</span> *<a name="line.623"></a>
  632. <span class="sourceLineNo">624</span> * @return The dataset (possibly &lt;code&gt;null&lt;/code&gt;).<a name="line.624"></a>
  633. <span class="sourceLineNo">625</span> *<a name="line.625"></a>
  634. <span class="sourceLineNo">626</span> * @see #setDataset(PieDataset)<a name="line.626"></a>
  635. <span class="sourceLineNo">627</span> */<a name="line.627"></a>
  636. <span class="sourceLineNo">628</span> public PieDataset getDataset() {<a name="line.628"></a>
  637. <span class="sourceLineNo">629</span> return this.dataset;<a name="line.629"></a>
  638. <span class="sourceLineNo">630</span> }<a name="line.630"></a>
  639. <span class="sourceLineNo">631</span><a name="line.631"></a>
  640. <span class="sourceLineNo">632</span> /**<a name="line.632"></a>
  641. <span class="sourceLineNo">633</span> * Sets the dataset and sends a {@link DatasetChangeEvent} to 'this'.<a name="line.633"></a>
  642. <span class="sourceLineNo">634</span> *<a name="line.634"></a>
  643. <span class="sourceLineNo">635</span> * @param dataset the dataset (&lt;code&gt;null&lt;/code&gt; permitted).<a name="line.635"></a>
  644. <span class="sourceLineNo">636</span> *<a name="line.636"></a>
  645. <span class="sourceLineNo">637</span> * @see #getDataset()<a name="line.637"></a>
  646. <span class="sourceLineNo">638</span> */<a name="line.638"></a>
  647. <span class="sourceLineNo">639</span> public void setDataset(PieDataset dataset) {<a name="line.639"></a>
  648. <span class="sourceLineNo">640</span> // if there is an existing dataset, remove the plot from the list of<a name="line.640"></a>
  649. <span class="sourceLineNo">641</span> // change listeners...<a name="line.641"></a>
  650. <span class="sourceLineNo">642</span> PieDataset existing = this.dataset;<a name="line.642"></a>
  651. <span class="sourceLineNo">643</span> if (existing != null) {<a name="line.643"></a>
  652. <span class="sourceLineNo">644</span> existing.removeChangeListener(this);<a name="line.644"></a>
  653. <span class="sourceLineNo">645</span> }<a name="line.645"></a>
  654. <span class="sourceLineNo">646</span><a name="line.646"></a>
  655. <span class="sourceLineNo">647</span> // set the new dataset, and register the chart as a change listener...<a name="line.647"></a>
  656. <span class="sourceLineNo">648</span> this.dataset = dataset;<a name="line.648"></a>
  657. <span class="sourceLineNo">649</span> if (dataset != null) {<a name="line.649"></a>
  658. <span class="sourceLineNo">650</span> setDatasetGroup(dataset.getGroup());<a name="line.650"></a>
  659. <span class="sourceLineNo">651</span> dataset.addChangeListener(this);<a name="line.651"></a>
  660. <span class="sourceLineNo">652</span> }<a name="line.652"></a>
  661. <span class="sourceLineNo">653</span><a name="line.653"></a>
  662. <span class="sourceLineNo">654</span> // send a dataset change event to self...<a name="line.654"></a>
  663. <span class="sourceLineNo">655</span> DatasetChangeEvent event = new DatasetChangeEvent(this, dataset);<a name="line.655"></a>
  664. <span class="sourceLineNo">656</span> datasetChanged(event);<a name="line.656"></a>
  665. <span class="sourceLineNo">657</span> }<a name="line.657"></a>
  666. <span class="sourceLineNo">658</span><a name="line.658"></a>
  667. <span class="sourceLineNo">659</span> /**<a name="line.659"></a>
  668. <span class="sourceLineNo">660</span> * Returns the pie index (this is used by the {@link MultiplePiePlot} class<a name="line.660"></a>
  669. <span class="sourceLineNo">661</span> * to track subplots).<a name="line.661"></a>
  670. <span class="sourceLineNo">662</span> *<a name="line.662"></a>
  671. <span class="sourceLineNo">663</span> * @return The pie index.<a name="line.663"></a>
  672. <span class="sourceLineNo">664</span> *<a name="line.664"></a>
  673. <span class="sourceLineNo">665</span> * @see #setPieIndex(int)<a name="line.665"></a>
  674. <span class="sourceLineNo">666</span> */<a name="line.666"></a>
  675. <span class="sourceLineNo">667</span> public int getPieIndex() {<a name="line.667"></a>
  676. <span class="sourceLineNo">668</span> return this.pieIndex;<a name="line.668"></a>
  677. <span class="sourceLineNo">669</span> }<a name="line.669"></a>
  678. <span class="sourceLineNo">670</span><a name="line.670"></a>
  679. <span class="sourceLineNo">671</span> /**<a name="line.671"></a>
  680. <span class="sourceLineNo">672</span> * Sets the pie index (this is used by the {@link MultiplePiePlot} class to<a name="line.672"></a>
  681. <span class="sourceLineNo">673</span> * track subplots).<a name="line.673"></a>
  682. <span class="sourceLineNo">674</span> *<a name="line.674"></a>
  683. <span class="sourceLineNo">675</span> * @param index the index.<a name="line.675"></a>
  684. <span class="sourceLineNo">676</span> *<a name="line.676"></a>
  685. <span class="sourceLineNo">677</span> * @see #getPieIndex()<a name="line.677"></a>
  686. <span class="sourceLineNo">678</span> */<a name="line.678"></a>
  687. <span class="sourceLineNo">679</span> public void setPieIndex(int index) {<a name="line.679"></a>
  688. <span class="sourceLineNo">680</span> this.pieIndex = index;<a name="line.680"></a>
  689. <span class="sourceLineNo">681</span> }<a name="line.681"></a>
  690. <span class="sourceLineNo">682</span><a name="line.682"></a>
  691. <span class="sourceLineNo">683</span> /**<a name="line.683"></a>
  692. <span class="sourceLineNo">684</span> * Returns the start angle for the first pie section. This is measured in<a name="line.684"></a>
  693. <span class="sourceLineNo">685</span> * degrees starting from 3 o'clock and measuring anti-clockwise.<a name="line.685"></a>
  694. <span class="sourceLineNo">686</span> *<a name="line.686"></a>
  695. <span class="sourceLineNo">687</span> * @return The start angle.<a name="line.687"></a>
  696. <span class="sourceLineNo">688</span> *<a name="line.688"></a>
  697. <span class="sourceLineNo">689</span> * @see #setStartAngle(double)<a name="line.689"></a>
  698. <span class="sourceLineNo">690</span> */<a name="line.690"></a>
  699. <span class="sourceLineNo">691</span> public double getStartAngle() {<a name="line.691"></a>
  700. <span class="sourceLineNo">692</span> return this.startAngle;<a name="line.692"></a>
  701. <span class="sourceLineNo">693</span> }<a name="line.693"></a>
  702. <span class="sourceLineNo">694</span><a name="line.694"></a>
  703. <span class="sourceLineNo">695</span> /**<a name="line.695"></a>
  704. <span class="sourceLineNo">696</span> * Sets the starting angle and sends a {@link PlotChangeEvent} to all<a name="line.696"></a>
  705. <span class="sourceLineNo">697</span> * registered listeners. The initial default value is 90 degrees, which<a name="line.697"></a>
  706. <span class="sourceLineNo">698</span> * corresponds to 12 o'clock. A value of zero corresponds to 3 o'clock...<a name="line.698"></a>
  707. <span class="sourceLineNo">699</span> * this is the encoding used by Java's Arc2D class.<a name="line.699"></a>
  708. <span class="sourceLineNo">700</span> *<a name="line.700"></a>
  709. <span class="sourceLineNo">701</span> * @param angle the angle (in degrees).<a name="line.701"></a>
  710. <span class="sourceLineNo">702</span> *<a name="line.702"></a>
  711. <span class="sourceLineNo">703</span> * @see #getStartAngle()<a name="line.703"></a>
  712. <span class="sourceLineNo">704</span> */<a name="line.704"></a>
  713. <span class="sourceLineNo">705</span> public void setStartAngle(double angle) {<a name="line.705"></a>
  714. <span class="sourceLineNo">706</span> this.startAngle = angle;<a name="line.706"></a>
  715. <span class="sourceLineNo">707</span> fireChangeEvent();<a name="line.707"></a>
  716. <span class="sourceLineNo">708</span> }<a name="line.708"></a>
  717. <span class="sourceLineNo">709</span><a name="line.709"></a>
  718. <span class="sourceLineNo">710</span> /**<a name="line.710"></a>
  719. <span class="sourceLineNo">711</span> * Returns the direction in which the pie sections are drawn (clockwise or<a name="line.711"></a>
  720. <span class="sourceLineNo">712</span> * anti-clockwise).<a name="line.712"></a>
  721. <span class="sourceLineNo">713</span> *<a name="line.713"></a>
  722. <span class="sourceLineNo">714</span> * @return The direction (never &lt;code&gt;null&lt;/code&gt;).<a name="line.714"></a>
  723. <span class="sourceLineNo">715</span> *<a name="line.715"></a>
  724. <span class="sourceLineNo">716</span> * @see #setDirection(Rotation)<a name="line.716"></a>
  725. <span class="sourceLineNo">717</span> */<a name="line.717"></a>
  726. <span class="sourceLineNo">718</span> public Rotation getDirection() {<a name="line.718"></a>
  727. <span class="sourceLineNo">719</span> return this.direction;<a name="line.719"></a>
  728. <span class="sourceLineNo">720</span> }<a name="line.720"></a>
  729. <span class="sourceLineNo">721</span><a name="line.721"></a>
  730. <span class="sourceLineNo">722</span> /**<a name="line.722"></a>
  731. <span class="sourceLineNo">723</span> * Sets the direction in which the pie sections are drawn and sends a<a name="line.723"></a>
  732. <span class="sourceLineNo">724</span> * {@link PlotChangeEvent} to all registered listeners.<a name="line.724"></a>
  733. <span class="sourceLineNo">725</span> *<a name="line.725"></a>
  734. <span class="sourceLineNo">726</span> * @param direction the direction (&lt;code&gt;null&lt;/code&gt; not permitted).<a name="line.726"></a>
  735. <span class="sourceLineNo">727</span> *<a name="line.727"></a>
  736. <span class="sourceLineNo">728</span> * @see #getDirection()<a name="line.728"></a>
  737. <span class="sourceLineNo">729</span> */<a name="line.729"></a>
  738. <span class="sourceLineNo">730</span> public void setDirection(Rotation direction) {<a name="line.730"></a>
  739. <span class="sourceLineNo">731</span> ParamChecks.nullNotPermitted(direction, "direction");<a name="line.731"></a>
  740. <span class="sourceLineNo">732</span> this.direction = direction;<a name="line.732"></a>
  741. <span class="sourceLineNo">733</span> fireChangeEvent();<a name="line.733"></a>
  742. <span class="sourceLineNo">734</span><a name="line.734"></a>
  743. <span class="sourceLineNo">735</span> }<a name="line.735"></a>
  744. <span class="sourceLineNo">736</span><a name="line.736"></a>
  745. <span class="sourceLineNo">737</span> /**<a name="line.737"></a>
  746. <span class="sourceLineNo">738</span> * Returns the interior gap, measured as a percentage of the available<a name="line.738"></a>
  747. <span class="sourceLineNo">739</span> * drawing space.<a name="line.739"></a>
  748. <span class="sourceLineNo">740</span> *<a name="line.740"></a>
  749. <span class="sourceLineNo">741</span> * @return The gap (as a percentage of the available drawing space).<a name="line.741"></a>
  750. <span class="sourceLineNo">742</span> *<a name="line.742"></a>
  751. <span class="sourceLineNo">743</span> * @see #setInteriorGap(double)<a name="line.743"></a>
  752. <span class="sourceLineNo">744</span> */<a name="line.744"></a>
  753. <span class="sourceLineNo">745</span> public double getInteriorGap() {<a name="line.745"></a>
  754. <span class="sourceLineNo">746</span> return this.interiorGap;<a name="line.746"></a>
  755. <span class="sourceLineNo">747</span> }<a name="line.747"></a>
  756. <span class="sourceLineNo">748</span><a name="line.748"></a>
  757. <span class="sourceLineNo">749</span> /**<a name="line.749"></a>
  758. <span class="sourceLineNo">750</span> * Sets the interior gap and sends a {@link PlotChangeEvent} to all<a name="line.750"></a>
  759. <span class="sourceLineNo">751</span> * registered listeners. This controls the space between the edges of the<a name="line.751"></a>
  760. <span class="sourceLineNo">752</span> * pie plot and the plot area itself (the region where the section labels<a name="line.752"></a>
  761. <span class="sourceLineNo">753</span> * appear).<a name="line.753"></a>
  762. <span class="sourceLineNo">754</span> *<a name="line.754"></a>
  763. <span class="sourceLineNo">755</span> * @param percent the gap (as a percentage of the available drawing space).<a name="line.755"></a>
  764. <span class="sourceLineNo">756</span> *<a name="line.756"></a>
  765. <span class="sourceLineNo">757</span> * @see #getInteriorGap()<a name="line.757"></a>
  766. <span class="sourceLineNo">758</span> */<a name="line.758"></a>
  767. <span class="sourceLineNo">759</span> public void setInteriorGap(double percent) {<a name="line.759"></a>
  768. <span class="sourceLineNo">760</span><a name="line.760"></a>
  769. <span class="sourceLineNo">761</span> if ((percent &lt; 0.0) || (percent &gt; MAX_INTERIOR_GAP)) {<a name="line.761"></a>
  770. <span class="sourceLineNo">762</span> throw new IllegalArgumentException(<a name="line.762"></a>
  771. <span class="sourceLineNo">763</span> "Invalid 'percent' (" + percent + ") argument.");<a name="line.763"></a>
  772. <span class="sourceLineNo">764</span> }<a name="line.764"></a>
  773. <span class="sourceLineNo">765</span><a name="line.765"></a>
  774. <span class="sourceLineNo">766</span> if (this.interiorGap != percent) {<a name="line.766"></a>
  775. <span class="sourceLineNo">767</span> this.interiorGap = percent;<a name="line.767"></a>
  776. <span class="sourceLineNo">768</span> fireChangeEvent();<a name="line.768"></a>
  777. <span class="sourceLineNo">769</span> }<a name="line.769"></a>
  778. <span class="sourceLineNo">770</span><a name="line.770"></a>
  779. <span class="sourceLineNo">771</span> }<a name="line.771"></a>
  780. <span class="sourceLineNo">772</span><a name="line.772"></a>
  781. <span class="sourceLineNo">773</span> /**<a name="line.773"></a>
  782. <span class="sourceLineNo">774</span> * Returns a flag indicating whether the pie chart is circular, or<a name="line.774"></a>
  783. <span class="sourceLineNo">775</span> * stretched into an elliptical shape.<a name="line.775"></a>
  784. <span class="sourceLineNo">776</span> *<a name="line.776"></a>
  785. <span class="sourceLineNo">777</span> * @return A flag indicating whether the pie chart is circular.<a name="line.777"></a>
  786. <span class="sourceLineNo">778</span> *<a name="line.778"></a>
  787. <span class="sourceLineNo">779</span> * @see #setCircular(boolean)<a name="line.779"></a>
  788. <span class="sourceLineNo">780</span> */<a name="line.780"></a>
  789. <span class="sourceLineNo">781</span> public boolean isCircular() {<a name="line.781"></a>
  790. <span class="sourceLineNo">782</span> return this.circular;<a name="line.782"></a>
  791. <span class="sourceLineNo">783</span> }<a name="line.783"></a>
  792. <span class="sourceLineNo">784</span><a name="line.784"></a>
  793. <span class="sourceLineNo">785</span> /**<a name="line.785"></a>
  794. <span class="sourceLineNo">786</span> * A flag indicating whether the pie chart is circular, or stretched into<a name="line.786"></a>
  795. <span class="sourceLineNo">787</span> * an elliptical shape.<a name="line.787"></a>
  796. <span class="sourceLineNo">788</span> *<a name="line.788"></a>
  797. <span class="sourceLineNo">789</span> * @param flag the new value.<a name="line.789"></a>
  798. <span class="sourceLineNo">790</span> *<a name="line.790"></a>
  799. <span class="sourceLineNo">791</span> * @see #isCircular()<a name="line.791"></a>
  800. <span class="sourceLineNo">792</span> */<a name="line.792"></a>
  801. <span class="sourceLineNo">793</span> public void setCircular(boolean flag) {<a name="line.793"></a>
  802. <span class="sourceLineNo">794</span> setCircular(flag, true);<a name="line.794"></a>
  803. <span class="sourceLineNo">795</span> }<a name="line.795"></a>
  804. <span class="sourceLineNo">796</span><a name="line.796"></a>
  805. <span class="sourceLineNo">797</span> /**<a name="line.797"></a>
  806. <span class="sourceLineNo">798</span> * Sets the circular attribute and, if requested, sends a<a name="line.798"></a>
  807. <span class="sourceLineNo">799</span> * {@link PlotChangeEvent} to all registered listeners.<a name="line.799"></a>
  808. <span class="sourceLineNo">800</span> *<a name="line.800"></a>
  809. <span class="sourceLineNo">801</span> * @param circular the new value of the flag.<a name="line.801"></a>
  810. <span class="sourceLineNo">802</span> * @param notify notify listeners?<a name="line.802"></a>
  811. <span class="sourceLineNo">803</span> *<a name="line.803"></a>
  812. <span class="sourceLineNo">804</span> * @see #isCircular()<a name="line.804"></a>
  813. <span class="sourceLineNo">805</span> */<a name="line.805"></a>
  814. <span class="sourceLineNo">806</span> public void setCircular(boolean circular, boolean notify) {<a name="line.806"></a>
  815. <span class="sourceLineNo">807</span> this.circular = circular;<a name="line.807"></a>
  816. <span class="sourceLineNo">808</span> if (notify) {<a name="line.808"></a>
  817. <span class="sourceLineNo">809</span> fireChangeEvent();<a name="line.809"></a>
  818. <span class="sourceLineNo">810</span> }<a name="line.810"></a>
  819. <span class="sourceLineNo">811</span> }<a name="line.811"></a>
  820. <span class="sourceLineNo">812</span><a name="line.812"></a>
  821. <span class="sourceLineNo">813</span> /**<a name="line.813"></a>
  822. <span class="sourceLineNo">814</span> * Returns the flag that controls whether &lt;code&gt;null&lt;/code&gt; values in the<a name="line.814"></a>
  823. <span class="sourceLineNo">815</span> * dataset are ignored.<a name="line.815"></a>
  824. <span class="sourceLineNo">816</span> *<a name="line.816"></a>
  825. <span class="sourceLineNo">817</span> * @return A boolean.<a name="line.817"></a>
  826. <span class="sourceLineNo">818</span> *<a name="line.818"></a>
  827. <span class="sourceLineNo">819</span> * @see #setIgnoreNullValues(boolean)<a name="line.819"></a>
  828. <span class="sourceLineNo">820</span> */<a name="line.820"></a>
  829. <span class="sourceLineNo">821</span> public boolean getIgnoreNullValues() {<a name="line.821"></a>
  830. <span class="sourceLineNo">822</span> return this.ignoreNullValues;<a name="line.822"></a>
  831. <span class="sourceLineNo">823</span> }<a name="line.823"></a>
  832. <span class="sourceLineNo">824</span><a name="line.824"></a>
  833. <span class="sourceLineNo">825</span> /**<a name="line.825"></a>
  834. <span class="sourceLineNo">826</span> * Sets a flag that controls whether &lt;code&gt;null&lt;/code&gt; values are ignored,<a name="line.826"></a>
  835. <span class="sourceLineNo">827</span> * and sends a {@link PlotChangeEvent} to all registered listeners. At<a name="line.827"></a>
  836. <span class="sourceLineNo">828</span> * present, this only affects whether or not the key is presented in the<a name="line.828"></a>
  837. <span class="sourceLineNo">829</span> * legend.<a name="line.829"></a>
  838. <span class="sourceLineNo">830</span> *<a name="line.830"></a>
  839. <span class="sourceLineNo">831</span> * @param flag the flag.<a name="line.831"></a>
  840. <span class="sourceLineNo">832</span> *<a name="line.832"></a>
  841. <span class="sourceLineNo">833</span> * @see #getIgnoreNullValues()<a name="line.833"></a>
  842. <span class="sourceLineNo">834</span> * @see #setIgnoreZeroValues(boolean)<a name="line.834"></a>
  843. <span class="sourceLineNo">835</span> */<a name="line.835"></a>
  844. <span class="sourceLineNo">836</span> public void setIgnoreNullValues(boolean flag) {<a name="line.836"></a>
  845. <span class="sourceLineNo">837</span> this.ignoreNullValues = flag;<a name="line.837"></a>
  846. <span class="sourceLineNo">838</span> fireChangeEvent();<a name="line.838"></a>
  847. <span class="sourceLineNo">839</span> }<a name="line.839"></a>
  848. <span class="sourceLineNo">840</span><a name="line.840"></a>
  849. <span class="sourceLineNo">841</span> /**<a name="line.841"></a>
  850. <span class="sourceLineNo">842</span> * Returns the flag that controls whether zero values in the<a name="line.842"></a>
  851. <span class="sourceLineNo">843</span> * dataset are ignored.<a name="line.843"></a>
  852. <span class="sourceLineNo">844</span> *<a name="line.844"></a>
  853. <span class="sourceLineNo">845</span> * @return A boolean.<a name="line.845"></a>
  854. <span class="sourceLineNo">846</span> *<a name="line.846"></a>
  855. <span class="sourceLineNo">847</span> * @see #setIgnoreZeroValues(boolean)<a name="line.847"></a>
  856. <span class="sourceLineNo">848</span> */<a name="line.848"></a>
  857. <span class="sourceLineNo">849</span> public boolean getIgnoreZeroValues() {<a name="line.849"></a>
  858. <span class="sourceLineNo">850</span> return this.ignoreZeroValues;<a name="line.850"></a>
  859. <span class="sourceLineNo">851</span> }<a name="line.851"></a>
  860. <span class="sourceLineNo">852</span><a name="line.852"></a>
  861. <span class="sourceLineNo">853</span> /**<a name="line.853"></a>
  862. <span class="sourceLineNo">854</span> * Sets a flag that controls whether zero values are ignored,<a name="line.854"></a>
  863. <span class="sourceLineNo">855</span> * and sends a {@link PlotChangeEvent} to all registered listeners. This<a name="line.855"></a>
  864. <span class="sourceLineNo">856</span> * only affects whether or not a label appears for the non-visible<a name="line.856"></a>
  865. <span class="sourceLineNo">857</span> * pie section.<a name="line.857"></a>
  866. <span class="sourceLineNo">858</span> *<a name="line.858"></a>
  867. <span class="sourceLineNo">859</span> * @param flag the flag.<a name="line.859"></a>
  868. <span class="sourceLineNo">860</span> *<a name="line.860"></a>
  869. <span class="sourceLineNo">861</span> * @see #getIgnoreZeroValues()<a name="line.861"></a>
  870. <span class="sourceLineNo">862</span> * @see #setIgnoreNullValues(boolean)<a name="line.862"></a>
  871. <span class="sourceLineNo">863</span> */<a name="line.863"></a>
  872. <span class="sourceLineNo">864</span> public void setIgnoreZeroValues(boolean flag) {<a name="line.864"></a>
  873. <span class="sourceLineNo">865</span> this.ignoreZeroValues = flag;<a name="line.865"></a>
  874. <span class="sourceLineNo">866</span> fireChangeEvent();<a name="line.866"></a>
  875. <span class="sourceLineNo">867</span> }<a name="line.867"></a>
  876. <span class="sourceLineNo">868</span><a name="line.868"></a>
  877. <span class="sourceLineNo">869</span> //// SECTION PAINT ////////////////////////////////////////////////////////<a name="line.869"></a>
  878. <span class="sourceLineNo">870</span><a name="line.870"></a>
  879. <span class="sourceLineNo">871</span> /**<a name="line.871"></a>
  880. <span class="sourceLineNo">872</span> * Returns the paint for the specified section. This is equivalent to<a name="line.872"></a>
  881. <span class="sourceLineNo">873</span> * &lt;code&gt;lookupSectionPaint(section, getAutoPopulateSectionPaint())&lt;/code&gt;.<a name="line.873"></a>
  882. <span class="sourceLineNo">874</span> *<a name="line.874"></a>
  883. <span class="sourceLineNo">875</span> * @param key the section key.<a name="line.875"></a>
  884. <span class="sourceLineNo">876</span> *<a name="line.876"></a>
  885. <span class="sourceLineNo">877</span> * @return The paint for the specified section.<a name="line.877"></a>
  886. <span class="sourceLineNo">878</span> *<a name="line.878"></a>
  887. <span class="sourceLineNo">879</span> * @since 1.0.3<a name="line.879"></a>
  888. <span class="sourceLineNo">880</span> *<a name="line.880"></a>
  889. <span class="sourceLineNo">881</span> * @see #lookupSectionPaint(Comparable, boolean)<a name="line.881"></a>
  890. <span class="sourceLineNo">882</span> */<a name="line.882"></a>
  891. <span class="sourceLineNo">883</span> protected Paint lookupSectionPaint(Comparable key) {<a name="line.883"></a>
  892. <span class="sourceLineNo">884</span> return lookupSectionPaint(key, getAutoPopulateSectionPaint());<a name="line.884"></a>
  893. <span class="sourceLineNo">885</span> }<a name="line.885"></a>
  894. <span class="sourceLineNo">886</span><a name="line.886"></a>
  895. <span class="sourceLineNo">887</span> /**<a name="line.887"></a>
  896. <span class="sourceLineNo">888</span> * Returns the paint for the specified section. The lookup involves these<a name="line.888"></a>
  897. <span class="sourceLineNo">889</span> * steps:<a name="line.889"></a>
  898. <span class="sourceLineNo">890</span> * &lt;ul&gt;<a name="line.890"></a>
  899. <span class="sourceLineNo">891</span> * &lt;li&gt;if {@link #getSectionPaint()} is non-&lt;code&gt;null&lt;/code&gt;, return<a name="line.891"></a>
  900. <span class="sourceLineNo">892</span> * it;&lt;/li&gt;<a name="line.892"></a>
  901. <span class="sourceLineNo">893</span> * &lt;li&gt;if {@link #getSectionPaint(int)} is non-&lt;code&gt;null&lt;/code&gt; return<a name="line.893"></a>
  902. <span class="sourceLineNo">894</span> * it;&lt;/li&gt;<a name="line.894"></a>
  903. <span class="sourceLineNo">895</span> * &lt;li&gt;if {@link #getSectionPaint(int)} is &lt;code&gt;null&lt;/code&gt; but<a name="line.895"></a>
  904. <span class="sourceLineNo">896</span> * &lt;code&gt;autoPopulate&lt;/code&gt; is &lt;code&gt;true&lt;/code&gt;, attempt to fetch<a name="line.896"></a>
  905. <span class="sourceLineNo">897</span> * a new paint from the drawing supplier<a name="line.897"></a>
  906. <span class="sourceLineNo">898</span> * ({@link #getDrawingSupplier()});<a name="line.898"></a>
  907. <span class="sourceLineNo">899</span> * &lt;li&gt;if all else fails, return {@link #getBaseSectionPaint()}.<a name="line.899"></a>
  908. <span class="sourceLineNo">900</span> * &lt;/ul&gt;<a name="line.900"></a>
  909. <span class="sourceLineNo">901</span> *<a name="line.901"></a>
  910. <span class="sourceLineNo">902</span> * @param key the section key.<a name="line.902"></a>
  911. <span class="sourceLineNo">903</span> * @param autoPopulate a flag that controls whether the drawing supplier<a name="line.903"></a>
  912. <span class="sourceLineNo">904</span> * is used to auto-populate the section paint settings.<a name="line.904"></a>
  913. <span class="sourceLineNo">905</span> *<a name="line.905"></a>
  914. <span class="sourceLineNo">906</span> * @return The paint.<a name="line.906"></a>
  915. <span class="sourceLineNo">907</span> *<a name="line.907"></a>
  916. <span class="sourceLineNo">908</span> * @since 1.0.3<a name="line.908"></a>
  917. <span class="sourceLineNo">909</span> */<a name="line.909"></a>
  918. <span class="sourceLineNo">910</span> protected Paint lookupSectionPaint(Comparable key, boolean autoPopulate) {<a name="line.910"></a>
  919. <span class="sourceLineNo">911</span><a name="line.911"></a>
  920. <span class="sourceLineNo">912</span> // is there an override?<a name="line.912"></a>
  921. <span class="sourceLineNo">913</span> Paint result = getSectionPaint();<a name="line.913"></a>
  922. <span class="sourceLineNo">914</span> if (result != null) {<a name="line.914"></a>
  923. <span class="sourceLineNo">915</span> return result;<a name="line.915"></a>
  924. <span class="sourceLineNo">916</span> }<a name="line.916"></a>
  925. <span class="sourceLineNo">917</span><a name="line.917"></a>
  926. <span class="sourceLineNo">918</span> // if not, check if there is a paint defined for the specified key<a name="line.918"></a>
  927. <span class="sourceLineNo">919</span> result = this.sectionPaintMap.getPaint(key);<a name="line.919"></a>
  928. <span class="sourceLineNo">920</span> if (result != null) {<a name="line.920"></a>
  929. <span class="sourceLineNo">921</span> return result;<a name="line.921"></a>
  930. <span class="sourceLineNo">922</span> }<a name="line.922"></a>
  931. <span class="sourceLineNo">923</span><a name="line.923"></a>
  932. <span class="sourceLineNo">924</span> // nothing defined - do we autoPopulate?<a name="line.924"></a>
  933. <span class="sourceLineNo">925</span> if (autoPopulate) {<a name="line.925"></a>
  934. <span class="sourceLineNo">926</span> DrawingSupplier ds = getDrawingSupplier();<a name="line.926"></a>
  935. <span class="sourceLineNo">927</span> if (ds != null) {<a name="line.927"></a>
  936. <span class="sourceLineNo">928</span> result = ds.getNextPaint();<a name="line.928"></a>
  937. <span class="sourceLineNo">929</span> this.sectionPaintMap.put(key, result);<a name="line.929"></a>
  938. <span class="sourceLineNo">930</span> }<a name="line.930"></a>
  939. <span class="sourceLineNo">931</span> else {<a name="line.931"></a>
  940. <span class="sourceLineNo">932</span> result = this.baseSectionPaint;<a name="line.932"></a>
  941. <span class="sourceLineNo">933</span> }<a name="line.933"></a>
  942. <span class="sourceLineNo">934</span> }<a name="line.934"></a>
  943. <span class="sourceLineNo">935</span> else {<a name="line.935"></a>
  944. <span class="sourceLineNo">936</span> result = this.baseSectionPaint;<a name="line.936"></a>
  945. <span class="sourceLineNo">937</span> }<a name="line.937"></a>
  946. <span class="sourceLineNo">938</span> return result;<a name="line.938"></a>
  947. <span class="sourceLineNo">939</span> }<a name="line.939"></a>
  948. <span class="sourceLineNo">940</span><a name="line.940"></a>
  949. <span class="sourceLineNo">941</span> /**<a name="line.941"></a>
  950. <span class="sourceLineNo">942</span> * Returns the paint for ALL sections in the plot.<a name="line.942"></a>
  951. <span class="sourceLineNo">943</span> *<a name="line.943"></a>
  952. <span class="sourceLineNo">944</span> * @return The paint (possibly &lt;code&gt;null&lt;/code&gt;).<a name="line.944"></a>
  953. <span class="sourceLineNo">945</span> *<a name="line.945"></a>
  954. <span class="sourceLineNo">946</span> * @see #setSectionPaint(Paint)<a name="line.946"></a>
  955. <span class="sourceLineNo">947</span> *<a name="line.947"></a>
  956. <span class="sourceLineNo">948</span> * @deprecated Use {@link #getSectionPaint(Comparable)} and<a name="line.948"></a>
  957. <span class="sourceLineNo">949</span> * {@link #getBaseSectionPaint()}. Deprecated as of version 1.0.6.<a name="line.949"></a>
  958. <span class="sourceLineNo">950</span> */<a name="line.950"></a>
  959. <span class="sourceLineNo">951</span> public Paint getSectionPaint() {<a name="line.951"></a>
  960. <span class="sourceLineNo">952</span> return this.sectionPaint;<a name="line.952"></a>
  961. <span class="sourceLineNo">953</span> }<a name="line.953"></a>
  962. <span class="sourceLineNo">954</span><a name="line.954"></a>
  963. <span class="sourceLineNo">955</span> /**<a name="line.955"></a>
  964. <span class="sourceLineNo">956</span> * Sets the paint for ALL sections in the plot. If this is set to<a name="line.956"></a>
  965. <span class="sourceLineNo">957</span> * {@code null}, then a list of paints is used instead (to allow<a name="line.957"></a>
  966. <span class="sourceLineNo">958</span> * different colors to be used for each section).<a name="line.958"></a>
  967. <span class="sourceLineNo">959</span> *<a name="line.959"></a>
  968. <span class="sourceLineNo">960</span> * @param paint the paint (&lt;code&gt;null&lt;/code&gt; permitted).<a name="line.960"></a>
  969. <span class="sourceLineNo">961</span> *<a name="line.961"></a>
  970. <span class="sourceLineNo">962</span> * @see #getSectionPaint()<a name="line.962"></a>
  971. <span class="sourceLineNo">963</span> *<a name="line.963"></a>
  972. <span class="sourceLineNo">964</span> * @deprecated Use {@link #setSectionPaint(Comparable, Paint)} and<a name="line.964"></a>
  973. <span class="sourceLineNo">965</span> * {@link #setBaseSectionPaint(Paint)}. Deprecated as of version 1.0.6.<a name="line.965"></a>
  974. <span class="sourceLineNo">966</span> */<a name="line.966"></a>
  975. <span class="sourceLineNo">967</span> public void setSectionPaint(Paint paint) {<a name="line.967"></a>
  976. <span class="sourceLineNo">968</span> this.sectionPaint = paint;<a name="line.968"></a>
  977. <span class="sourceLineNo">969</span> fireChangeEvent();<a name="line.969"></a>
  978. <span class="sourceLineNo">970</span> }<a name="line.970"></a>
  979. <span class="sourceLineNo">971</span><a name="line.971"></a>
  980. <span class="sourceLineNo">972</span> /**<a name="line.972"></a>
  981. <span class="sourceLineNo">973</span> * Returns a key for the specified section. If there is no such section<a name="line.973"></a>
  982. <span class="sourceLineNo">974</span> * in the dataset, we generate a key. This is to provide some backward<a name="line.974"></a>
  983. <span class="sourceLineNo">975</span> * compatibility for the (now deprecated) methods that get/set attributes<a name="line.975"></a>
  984. <span class="sourceLineNo">976</span> * based on section indices. The preferred way of doing this now is to<a name="line.976"></a>
  985. <span class="sourceLineNo">977</span> * link the attributes directly to the section key (there are new methods<a name="line.977"></a>
  986. <span class="sourceLineNo">978</span> * for this, starting from version 1.0.3).<a name="line.978"></a>
  987. <span class="sourceLineNo">979</span> *<a name="line.979"></a>
  988. <span class="sourceLineNo">980</span> * @param section the section index.<a name="line.980"></a>
  989. <span class="sourceLineNo">981</span> *<a name="line.981"></a>
  990. <span class="sourceLineNo">982</span> * @return The key.<a name="line.982"></a>
  991. <span class="sourceLineNo">983</span> *<a name="line.983"></a>
  992. <span class="sourceLineNo">984</span> * @since 1.0.3<a name="line.984"></a>
  993. <span class="sourceLineNo">985</span> */<a name="line.985"></a>
  994. <span class="sourceLineNo">986</span> protected Comparable getSectionKey(int section) {<a name="line.986"></a>
  995. <span class="sourceLineNo">987</span> Comparable key = null;<a name="line.987"></a>
  996. <span class="sourceLineNo">988</span> if (this.dataset != null) {<a name="line.988"></a>
  997. <span class="sourceLineNo">989</span> if (section &gt;= 0 &amp;&amp; section &lt; this.dataset.getItemCount()) {<a name="line.989"></a>
  998. <span class="sourceLineNo">990</span> key = this.dataset.getKey(section);<a name="line.990"></a>
  999. <span class="sourceLineNo">991</span> }<a name="line.991"></a>
  1000. <span class="sourceLineNo">992</span> }<a name="line.992"></a>
  1001. <span class="sourceLineNo">993</span> if (key == null) {<a name="line.993"></a>
  1002. <span class="sourceLineNo">994</span> key = new Integer(section);<a name="line.994"></a>
  1003. <span class="sourceLineNo">995</span> }<a name="line.995"></a>
  1004. <span class="sourceLineNo">996</span> return key;<a name="line.996"></a>
  1005. <span class="sourceLineNo">997</span> }<a name="line.997"></a>
  1006. <span class="sourceLineNo">998</span><a name="line.998"></a>
  1007. <span class="sourceLineNo">999</span> /**<a name="line.999"></a>
  1008. <span class="sourceLineNo">1000</span> * Returns the paint associated with the specified key, or<a name="line.1000"></a>
  1009. <span class="sourceLineNo">1001</span> * &lt;code&gt;null&lt;/code&gt; if there is no paint associated with the key.<a name="line.1001"></a>
  1010. <span class="sourceLineNo">1002</span> *<a name="line.1002"></a>
  1011. <span class="sourceLineNo">1003</span> * @param key the key (&lt;code&gt;null&lt;/code&gt; not permitted).<a name="line.1003"></a>
  1012. <span class="sourceLineNo">1004</span> *<a name="line.1004"></a>
  1013. <span class="sourceLineNo">1005</span> * @return The paint associated with the specified key, or<a name="line.1005"></a>
  1014. <span class="sourceLineNo">1006</span> * &lt;code&gt;null&lt;/code&gt;.<a name="line.1006"></a>
  1015. <span class="sourceLineNo">1007</span> *<a name="line.1007"></a>
  1016. <span class="sourceLineNo">1008</span> * @throws IllegalArgumentException if &lt;code&gt;key&lt;/code&gt; is<a name="line.1008"></a>
  1017. <span class="sourceLineNo">1009</span> * &lt;code&gt;null&lt;/code&gt;.<a name="line.1009"></a>
  1018. <span class="sourceLineNo">1010</span> *<a name="line.1010"></a>
  1019. <span class="sourceLineNo">1011</span> * @see #setSectionPaint(Comparable, Paint)<a name="line.1011"></a>
  1020. <span class="sourceLineNo">1012</span> *<a name="line.1012"></a>
  1021. <span class="sourceLineNo">1013</span> * @since 1.0.3<a name="line.1013"></a>
  1022. <span class="sourceLineNo">1014</span> */<a name="line.1014"></a>
  1023. <span class="sourceLineNo">1015</span> public Paint getSectionPaint(Comparable key) {<a name="line.1015"></a>
  1024. <span class="sourceLineNo">1016</span> // null argument check delegated...<a name="line.1016"></a>
  1025. <span class="sourceLineNo">1017</span> return this.sectionPaintMap.getPaint(key);<a name="line.1017"></a>
  1026. <span class="sourceLineNo">1018</span> }<a name="line.1018"></a>
  1027. <span class="sourceLineNo">1019</span><a name="line.1019"></a>
  1028. <span class="sourceLineNo">1020</span> /**<a name="line.1020"></a>
  1029. <span class="sourceLineNo">1021</span> * Sets the paint associated with the specified key, and sends a<a name="line.1021"></a>
  1030. <span class="sourceLineNo">1022</span> * {@link PlotChangeEvent} to all registered listeners.<a name="line.1022"></a>
  1031. <span class="sourceLineNo">1023</span> *<a name="line.1023"></a>
  1032. <span class="sourceLineNo">1024</span> * @param key the key (&lt;code&gt;null&lt;/code&gt; not permitted).<a name="line.1024"></a>
  1033. <span class="sourceLineNo">1025</span> * @param paint the paint.<a name="line.1025"></a>
  1034. <span class="sourceLineNo">1026</span> *<a name="line.1026"></a>
  1035. <span class="sourceLineNo">1027</span> * @throws IllegalArgumentException if &lt;code&gt;key&lt;/code&gt; is<a name="line.1027"></a>
  1036. <span class="sourceLineNo">1028</span> * &lt;code&gt;null&lt;/code&gt;.<a name="line.1028"></a>
  1037. <span class="sourceLineNo">1029</span> *<a name="line.1029"></a>
  1038. <span class="sourceLineNo">1030</span> * @see #getSectionPaint(Comparable)<a name="line.1030"></a>
  1039. <span class="sourceLineNo">1031</span> *<a name="line.1031"></a>
  1040. <span class="sourceLineNo">1032</span> * @since 1.0.3<a name="line.1032"></a>
  1041. <span class="sourceLineNo">1033</span> */<a name="line.1033"></a>
  1042. <span class="sourceLineNo">1034</span> public void setSectionPaint(Comparable key, Paint paint) {<a name="line.1034"></a>
  1043. <span class="sourceLineNo">1035</span> // null argument check delegated...<a name="line.1035"></a>
  1044. <span class="sourceLineNo">1036</span> this.sectionPaintMap.put(key, paint);<a name="line.1036"></a>
  1045. <span class="sourceLineNo">1037</span> fireChangeEvent();<a name="line.1037"></a>
  1046. <span class="sourceLineNo">1038</span> }<a name="line.1038"></a>
  1047. <span class="sourceLineNo">1039</span><a name="line.1039"></a>
  1048. <span class="sourceLineNo">1040</span> /**<a name="line.1040"></a>
  1049. <span class="sourceLineNo">1041</span> * Clears the section paint settings for this plot and, if requested, sends<a name="line.1041"></a>
  1050. <span class="sourceLineNo">1042</span> * a {@link PlotChangeEvent} to all registered listeners. Be aware that<a name="line.1042"></a>
  1051. <span class="sourceLineNo">1043</span> * if the &lt;code&gt;autoPopulateSectionPaint&lt;/code&gt; flag is set, the section<a name="line.1043"></a>
  1052. <span class="sourceLineNo">1044</span> * paints may be repopulated using the same colours as before.<a name="line.1044"></a>
  1053. <span class="sourceLineNo">1045</span> *<a name="line.1045"></a>
  1054. <span class="sourceLineNo">1046</span> * @param notify notify listeners?<a name="line.1046"></a>
  1055. <span class="sourceLineNo">1047</span> *<a name="line.1047"></a>
  1056. <span class="sourceLineNo">1048</span> * @since 1.0.11<a name="line.1048"></a>
  1057. <span class="sourceLineNo">1049</span> *<a name="line.1049"></a>
  1058. <span class="sourceLineNo">1050</span> * @see #autoPopulateSectionPaint<a name="line.1050"></a>
  1059. <span class="sourceLineNo">1051</span> */<a name="line.1051"></a>
  1060. <span class="sourceLineNo">1052</span> public void clearSectionPaints(boolean notify) {<a name="line.1052"></a>
  1061. <span class="sourceLineNo">1053</span> this.sectionPaintMap.clear();<a name="line.1053"></a>
  1062. <span class="sourceLineNo">1054</span> if (notify) {<a name="line.1054"></a>
  1063. <span class="sourceLineNo">1055</span> fireChangeEvent();<a name="line.1055"></a>
  1064. <span class="sourceLineNo">1056</span> }<a name="line.1056"></a>
  1065. <span class="sourceLineNo">1057</span> }<a name="line.1057"></a>
  1066. <span class="sourceLineNo">1058</span><a name="line.1058"></a>
  1067. <span class="sourceLineNo">1059</span> /**<a name="line.1059"></a>
  1068. <span class="sourceLineNo">1060</span> * Returns the base section paint. This is used when no other paint is<a name="line.1060"></a>
  1069. <span class="sourceLineNo">1061</span> * defined, which is rare. The default value is &lt;code&gt;Color.gray&lt;/code&gt;.<a name="line.1061"></a>
  1070. <span class="sourceLineNo">1062</span> *<a name="line.1062"></a>
  1071. <span class="sourceLineNo">1063</span> * @return The paint (never &lt;code&gt;null&lt;/code&gt;).<a name="line.1063"></a>
  1072. <span class="sourceLineNo">1064</span> *<a name="line.1064"></a>
  1073. <span class="sourceLineNo">1065</span> * @see #setBaseSectionPaint(Paint)<a name="line.1065"></a>
  1074. <span class="sourceLineNo">1066</span> */<a name="line.1066"></a>
  1075. <span class="sourceLineNo">1067</span> public Paint getBaseSectionPaint() {<a name="line.1067"></a>
  1076. <span class="sourceLineNo">1068</span> return this.baseSectionPaint;<a name="line.1068"></a>
  1077. <span class="sourceLineNo">1069</span> }<a name="line.1069"></a>
  1078. <span class="sourceLineNo">1070</span><a name="line.1070"></a>
  1079. <span class="sourceLineNo">1071</span> /**<a name="line.1071"></a>
  1080. <span class="sourceLineNo">1072</span> * Sets the base section paint and sends a {@link PlotChangeEvent} to all<a name="line.1072"></a>
  1081. <span class="sourceLineNo">1073</span> * registered listeners.<a name="line.1073"></a>
  1082. <span class="sourceLineNo">1074</span> *<a name="line.1074"></a>
  1083. <span class="sourceLineNo">1075</span> * @param paint the paint (&lt;code&gt;null&lt;/code&gt; not permitted).<a name="line.1075"></a>
  1084. <span class="sourceLineNo">1076</span> *<a name="line.1076"></a>
  1085. <span class="sourceLineNo">1077</span> * @see #getBaseSectionPaint()<a name="line.1077"></a>
  1086. <span class="sourceLineNo">1078</span> */<a name="line.1078"></a>
  1087. <span class="sourceLineNo">1079</span> public void setBaseSectionPaint(Paint paint) {<a name="line.1079"></a>
  1088. <span class="sourceLineNo">1080</span> ParamChecks.nullNotPermitted(paint, "paint");<a name="line.1080"></a>
  1089. <span class="sourceLineNo">1081</span> this.baseSectionPaint = paint;<a name="line.1081"></a>
  1090. <span class="sourceLineNo">1082</span> fireChangeEvent();<a name="line.1082"></a>
  1091. <span class="sourceLineNo">1083</span> }<a name="line.1083"></a>
  1092. <span class="sourceLineNo">1084</span><a name="line.1084"></a>
  1093. <span class="sourceLineNo">1085</span> /**<a name="line.1085"></a>
  1094. <span class="sourceLineNo">1086</span> * Returns the flag that controls whether or not the section paint is<a name="line.1086"></a>
  1095. <span class="sourceLineNo">1087</span> * auto-populated by the {@link #lookupSectionPaint(Comparable)} method.<a name="line.1087"></a>
  1096. <span class="sourceLineNo">1088</span> *<a name="line.1088"></a>
  1097. <span class="sourceLineNo">1089</span> * @return A boolean.<a name="line.1089"></a>
  1098. <span class="sourceLineNo">1090</span> *<a name="line.1090"></a>
  1099. <span class="sourceLineNo">1091</span> * @since 1.0.11<a name="line.1091"></a>
  1100. <span class="sourceLineNo">1092</span> */<a name="line.1092"></a>
  1101. <span class="sourceLineNo">1093</span> public boolean getAutoPopulateSectionPaint() {<a name="line.1093"></a>
  1102. <span class="sourceLineNo">1094</span> return this.autoPopulateSectionPaint;<a name="line.1094"></a>
  1103. <span class="sourceLineNo">1095</span> }<a name="line.1095"></a>
  1104. <span class="sourceLineNo">1096</span><a name="line.1096"></a>
  1105. <span class="sourceLineNo">1097</span> /**<a name="line.1097"></a>
  1106. <span class="sourceLineNo">1098</span> * Sets the flag that controls whether or not the section paint is<a name="line.1098"></a>
  1107. <span class="sourceLineNo">1099</span> * auto-populated by the {@link #lookupSectionPaint(Comparable)} method,<a name="line.1099"></a>
  1108. <span class="sourceLineNo">1100</span> * and sends a {@link PlotChangeEvent} to all registered listeners.<a name="line.1100"></a>
  1109. <span class="sourceLineNo">1101</span> *<a name="line.1101"></a>
  1110. <span class="sourceLineNo">1102</span> * @param auto auto-populate?<a name="line.1102"></a>
  1111. <span class="sourceLineNo">1103</span> *<a name="line.1103"></a>
  1112. <span class="sourceLineNo">1104</span> * @since 1.0.11<a name="line.1104"></a>
  1113. <span class="sourceLineNo">1105</span> */<a name="line.1105"></a>
  1114. <span class="sourceLineNo">1106</span> public void setAutoPopulateSectionPaint(boolean auto) {<a name="line.1106"></a>
  1115. <span class="sourceLineNo">1107</span> this.autoPopulateSectionPaint = auto;<a name="line.1107"></a>
  1116. <span class="sourceLineNo">1108</span> fireChangeEvent();<a name="line.1108"></a>
  1117. <span class="sourceLineNo">1109</span> }<a name="line.1109"></a>
  1118. <span class="sourceLineNo">1110</span><a name="line.1110"></a>
  1119. <span class="sourceLineNo">1111</span> //// SECTION OUTLINE PAINT ////////////////////////////////////////////////<a name="line.1111"></a>
  1120. <span class="sourceLineNo">1112</span><a name="line.1112"></a>
  1121. <span class="sourceLineNo">1113</span> /**<a name="line.1113"></a>
  1122. <span class="sourceLineNo">1114</span> * Returns the flag that controls whether or not the outline is drawn for<a name="line.1114"></a>
  1123. <span class="sourceLineNo">1115</span> * each pie section.<a name="line.1115"></a>
  1124. <span class="sourceLineNo">1116</span> *<a name="line.1116"></a>
  1125. <span class="sourceLineNo">1117</span> * @return The flag that controls whether or not the outline is drawn for<a name="line.1117"></a>
  1126. <span class="sourceLineNo">1118</span> * each pie section.<a name="line.1118"></a>
  1127. <span class="sourceLineNo">1119</span> *<a name="line.1119"></a>
  1128. <span class="sourceLineNo">1120</span> * @see #setSectionOutlinesVisible(boolean)<a name="line.1120"></a>
  1129. <span class="sourceLineNo">1121</span> */<a name="line.1121"></a>
  1130. <span class="sourceLineNo">1122</span> public boolean getSectionOutlinesVisible() {<a name="line.1122"></a>
  1131. <span class="sourceLineNo">1123</span> return this.sectionOutlinesVisible;<a name="line.1123"></a>
  1132. <span class="sourceLineNo">1124</span> }<a name="line.1124"></a>
  1133. <span class="sourceLineNo">1125</span><a name="line.1125"></a>
  1134. <span class="sourceLineNo">1126</span> /**<a name="line.1126"></a>
  1135. <span class="sourceLineNo">1127</span> * Sets the flag that controls whether or not the outline is drawn for<a name="line.1127"></a>
  1136. <span class="sourceLineNo">1128</span> * each pie section, and sends a {@link PlotChangeEvent} to all registered<a name="line.1128"></a>
  1137. <span class="sourceLineNo">1129</span> * listeners.<a name="line.1129"></a>
  1138. <span class="sourceLineNo">1130</span> *<a name="line.1130"></a>
  1139. <span class="sourceLineNo">1131</span> * @param visible the flag.<a name="line.1131"></a>
  1140. <span class="sourceLineNo">1132</span> *<a name="line.1132"></a>
  1141. <span class="sourceLineNo">1133</span> * @see #getSectionOutlinesVisible()<a name="line.1133"></a>
  1142. <span class="sourceLineNo">1134</span> */<a name="line.1134"></a>
  1143. <span class="sourceLineNo">1135</span> public void setSectionOutlinesVisible(boolean visible) {<a name="line.1135"></a>
  1144. <span class="sourceLineNo">1136</span> this.sectionOutlinesVisible = visible;<a name="line.1136"></a>
  1145. <span class="sourceLineNo">1137</span> fireChangeEvent();<a name="line.1137"></a>
  1146. <span class="sourceLineNo">1138</span> }<a name="line.1138"></a>
  1147. <span class="sourceLineNo">1139</span><a name="line.1139"></a>
  1148. <span class="sourceLineNo">1140</span> /**<a name="line.1140"></a>
  1149. <span class="sourceLineNo">1141</span> * Returns the outline paint for the specified section. This is equivalent<a name="line.1141"></a>
  1150. <span class="sourceLineNo">1142</span> * to &lt;code&gt;lookupSectionPaint(section,<a name="line.1142"></a>
  1151. <span class="sourceLineNo">1143</span> * getAutoPopulateSectionOutlinePaint())&lt;/code&gt;.<a name="line.1143"></a>
  1152. <span class="sourceLineNo">1144</span> *<a name="line.1144"></a>
  1153. <span class="sourceLineNo">1145</span> * @param key the section key.<a name="line.1145"></a>
  1154. <span class="sourceLineNo">1146</span> *<a name="line.1146"></a>
  1155. <span class="sourceLineNo">1147</span> * @return The paint for the specified section.<a name="line.1147"></a>
  1156. <span class="sourceLineNo">1148</span> *<a name="line.1148"></a>
  1157. <span class="sourceLineNo">1149</span> * @since 1.0.3<a name="line.1149"></a>
  1158. <span class="sourceLineNo">1150</span> *<a name="line.1150"></a>
  1159. <span class="sourceLineNo">1151</span> * @see #lookupSectionOutlinePaint(Comparable, boolean)<a name="line.1151"></a>
  1160. <span class="sourceLineNo">1152</span> */<a name="line.1152"></a>
  1161. <span class="sourceLineNo">1153</span> protected Paint lookupSectionOutlinePaint(Comparable key) {<a name="line.1153"></a>
  1162. <span class="sourceLineNo">1154</span> return lookupSectionOutlinePaint(key,<a name="line.1154"></a>
  1163. <span class="sourceLineNo">1155</span> getAutoPopulateSectionOutlinePaint());<a name="line.1155"></a>
  1164. <span class="sourceLineNo">1156</span> }<a name="line.1156"></a>
  1165. <span class="sourceLineNo">1157</span><a name="line.1157"></a>
  1166. <span class="sourceLineNo">1158</span> /**<a name="line.1158"></a>
  1167. <span class="sourceLineNo">1159</span> * Returns the outline paint for the specified section. The lookup<a name="line.1159"></a>
  1168. <span class="sourceLineNo">1160</span> * involves these steps:<a name="line.1160"></a>
  1169. <span class="sourceLineNo">1161</span> * &lt;ul&gt;<a name="line.1161"></a>
  1170. <span class="sourceLineNo">1162</span> * &lt;li&gt;if {@link #getSectionOutlinePaint()} is non-&lt;code&gt;null&lt;/code&gt;,<a name="line.1162"></a>
  1171. <span class="sourceLineNo">1163</span> * return it;&lt;/li&gt;<a name="line.1163"></a>
  1172. <span class="sourceLineNo">1164</span> * &lt;li&gt;otherwise, if {@link #getSectionOutlinePaint(int)} is<a name="line.1164"></a>
  1173. <span class="sourceLineNo">1165</span> * non-&lt;code&gt;null&lt;/code&gt; return it;&lt;/li&gt;<a name="line.1165"></a>
  1174. <span class="sourceLineNo">1166</span> * &lt;li&gt;if {@link #getSectionOutlinePaint(int)} is &lt;code&gt;null&lt;/code&gt; but<a name="line.1166"></a>
  1175. <span class="sourceLineNo">1167</span> * &lt;code&gt;autoPopulate&lt;/code&gt; is &lt;code&gt;true&lt;/code&gt;, attempt to fetch<a name="line.1167"></a>
  1176. <span class="sourceLineNo">1168</span> * a new outline paint from the drawing supplier<a name="line.1168"></a>
  1177. <span class="sourceLineNo">1169</span> * ({@link #getDrawingSupplier()});<a name="line.1169"></a>
  1178. <span class="sourceLineNo">1170</span> * &lt;li&gt;if all else fails, return {@link #getBaseSectionOutlinePaint()}.<a name="line.1170"></a>
  1179. <span class="sourceLineNo">1171</span> * &lt;/ul&gt;<a name="line.1171"></a>
  1180. <span class="sourceLineNo">1172</span> *<a name="line.1172"></a>
  1181. <span class="sourceLineNo">1173</span> * @param key the section key.<a name="line.1173"></a>
  1182. <span class="sourceLineNo">1174</span> * @param autoPopulate a flag that controls whether the drawing supplier<a name="line.1174"></a>
  1183. <span class="sourceLineNo">1175</span> * is used to auto-populate the section outline paint settings.<a name="line.1175"></a>
  1184. <span class="sourceLineNo">1176</span> *<a name="line.1176"></a>
  1185. <span class="sourceLineNo">1177</span> * @return The paint.<a name="line.1177"></a>
  1186. <span class="sourceLineNo">1178</span> *<a name="line.1178"></a>
  1187. <span class="sourceLineNo">1179</span> * @since 1.0.3<a name="line.1179"></a>
  1188. <span class="sourceLineNo">1180</span> */<a name="line.1180"></a>
  1189. <span class="sourceLineNo">1181</span> protected Paint lookupSectionOutlinePaint(Comparable key,<a name="line.1181"></a>
  1190. <span class="sourceLineNo">1182</span> boolean autoPopulate) {<a name="line.1182"></a>
  1191. <span class="sourceLineNo">1183</span><a name="line.1183"></a>
  1192. <span class="sourceLineNo">1184</span> // is there an override?<a name="line.1184"></a>
  1193. <span class="sourceLineNo">1185</span> Paint result = getSectionOutlinePaint();<a name="line.1185"></a>
  1194. <span class="sourceLineNo">1186</span> if (result != null) {<a name="line.1186"></a>
  1195. <span class="sourceLineNo">1187</span> return result;<a name="line.1187"></a>
  1196. <span class="sourceLineNo">1188</span> }<a name="line.1188"></a>
  1197. <span class="sourceLineNo">1189</span><a name="line.1189"></a>
  1198. <span class="sourceLineNo">1190</span> // if not, check if there is a paint defined for the specified key<a name="line.1190"></a>
  1199. <span class="sourceLineNo">1191</span> result = this.sectionOutlinePaintMap.getPaint(key);<a name="line.1191"></a>
  1200. <span class="sourceLineNo">1192</span> if (result != null) {<a name="line.1192"></a>
  1201. <span class="sourceLineNo">1193</span> return result;<a name="line.1193"></a>
  1202. <span class="sourceLineNo">1194</span> }<a name="line.1194"></a>
  1203. <span class="sourceLineNo">1195</span><a name="line.1195"></a>
  1204. <span class="sourceLineNo">1196</span> // nothing defined - do we autoPopulate?<a name="line.1196"></a>
  1205. <span class="sourceLineNo">1197</span> if (autoPopulate) {<a name="line.1197"></a>
  1206. <span class="sourceLineNo">1198</span> DrawingSupplier ds = getDrawingSupplier();<a name="line.1198"></a>
  1207. <span class="sourceLineNo">1199</span> if (ds != null) {<a name="line.1199"></a>
  1208. <span class="sourceLineNo">1200</span> result = ds.getNextOutlinePaint();<a name="line.1200"></a>
  1209. <span class="sourceLineNo">1201</span> this.sectionOutlinePaintMap.put(key, result);<a name="line.1201"></a>
  1210. <span class="sourceLineNo">1202</span> }<a name="line.1202"></a>
  1211. <span class="sourceLineNo">1203</span> else {<a name="line.1203"></a>
  1212. <span class="sourceLineNo">1204</span> result = this.baseSectionOutlinePaint;<a name="line.1204"></a>
  1213. <span class="sourceLineNo">1205</span> }<a name="line.1205"></a>
  1214. <span class="sourceLineNo">1206</span> }<a name="line.1206"></a>
  1215. <span class="sourceLineNo">1207</span> else {<a name="line.1207"></a>
  1216. <span class="sourceLineNo">1208</span> result = this.baseSectionOutlinePaint;<a name="line.1208"></a>
  1217. <span class="sourceLineNo">1209</span> }<a name="line.1209"></a>
  1218. <span class="sourceLineNo">1210</span> return result;<a name="line.1210"></a>
  1219. <span class="sourceLineNo">1211</span> }<a name="line.1211"></a>
  1220. <span class="sourceLineNo">1212</span><a name="line.1212"></a>
  1221. <span class="sourceLineNo">1213</span> /**<a name="line.1213"></a>
  1222. <span class="sourceLineNo">1214</span> * Returns the outline paint associated with the specified key, or<a name="line.1214"></a>
  1223. <span class="sourceLineNo">1215</span> * &lt;code&gt;null&lt;/code&gt; if there is no paint associated with the key.<a name="line.1215"></a>
  1224. <span class="sourceLineNo">1216</span> *<a name="line.1216"></a>
  1225. <span class="sourceLineNo">1217</span> * @param key the key (&lt;code&gt;null&lt;/code&gt; not permitted).<a name="line.1217"></a>
  1226. <span class="sourceLineNo">1218</span> *<a name="line.1218"></a>
  1227. <span class="sourceLineNo">1219</span> * @return The paint associated with the specified key, or<a name="line.1219"></a>
  1228. <span class="sourceLineNo">1220</span> * &lt;code&gt;null&lt;/code&gt;.<a name="line.1220"></a>
  1229. <span class="sourceLineNo">1221</span> *<a name="line.1221"></a>
  1230. <span class="sourceLineNo">1222</span> * @throws IllegalArgumentException if &lt;code&gt;key&lt;/code&gt; is<a name="line.1222"></a>
  1231. <span class="sourceLineNo">1223</span> * &lt;code&gt;null&lt;/code&gt;.<a name="line.1223"></a>
  1232. <span class="sourceLineNo">1224</span> *<a name="line.1224"></a>
  1233. <span class="sourceLineNo">1225</span> * @see #setSectionOutlinePaint(Comparable, Paint)<a name="line.1225"></a>
  1234. <span class="sourceLineNo">1226</span> *<a name="line.1226"></a>
  1235. <span class="sourceLineNo">1227</span> * @since 1.0.3<a name="line.1227"></a>
  1236. <span class="sourceLineNo">1228</span> */<a name="line.1228"></a>
  1237. <span class="sourceLineNo">1229</span> public Paint getSectionOutlinePaint(Comparable key) {<a name="line.1229"></a>
  1238. <span class="sourceLineNo">1230</span> // null argument check delegated...<a name="line.1230"></a>
  1239. <span class="sourceLineNo">1231</span> return this.sectionOutlinePaintMap.getPaint(key);<a name="line.1231"></a>
  1240. <span class="sourceLineNo">1232</span> }<a name="line.1232"></a>
  1241. <span class="sourceLineNo">1233</span><a name="line.1233"></a>
  1242. <span class="sourceLineNo">1234</span> /**<a name="line.1234"></a>
  1243. <span class="sourceLineNo">1235</span> * Sets the outline paint associated with the specified key, and sends a<a name="line.1235"></a>
  1244. <span class="sourceLineNo">1236</span> * {@link PlotChangeEvent} to all registered listeners.<a name="line.1236"></a>
  1245. <span class="sourceLineNo">1237</span> *<a name="line.1237"></a>
  1246. <span class="sourceLineNo">1238</span> * @param key the key (&lt;code&gt;null&lt;/code&gt; not permitted).<a name="line.1238"></a>
  1247. <span class="sourceLineNo">1239</span> * @param paint the paint.<a name="line.1239"></a>
  1248. <span class="sourceLineNo">1240</span> *<a name="line.1240"></a>
  1249. <span class="sourceLineNo">1241</span> * @throws IllegalArgumentException if &lt;code&gt;key&lt;/code&gt; is<a name="line.1241"></a>
  1250. <span class="sourceLineNo">1242</span> * &lt;code&gt;null&lt;/code&gt;.<a name="line.1242"></a>
  1251. <span class="sourceLineNo">1243</span> *<a name="line.1243"></a>
  1252. <span class="sourceLineNo">1244</span> * @see #getSectionOutlinePaint(Comparable)<a name="line.1244"></a>
  1253. <span class="sourceLineNo">1245</span> *<a name="line.1245"></a>
  1254. <span class="sourceLineNo">1246</span> * @since 1.0.3<a name="line.1246"></a>
  1255. <span class="sourceLineNo">1247</span> */<a name="line.1247"></a>
  1256. <span class="sourceLineNo">1248</span> public void setSectionOutlinePaint(Comparable key, Paint paint) {<a name="line.1248"></a>
  1257. <span class="sourceLineNo">1249</span> // null argument check delegated...<a name="line.1249"></a>
  1258. <span class="sourceLineNo">1250</span> this.sectionOutlinePaintMap.put(key, paint);<a name="line.1250"></a>
  1259. <span class="sourceLineNo">1251</span> fireChangeEvent();<a name="line.1251"></a>
  1260. <span class="sourceLineNo">1252</span> }<a name="line.1252"></a>
  1261. <span class="sourceLineNo">1253</span><a name="line.1253"></a>
  1262. <span class="sourceLineNo">1254</span> /**<a name="line.1254"></a>
  1263. <span class="sourceLineNo">1255</span> * Clears the section outline paint settings for this plot and, if<a name="line.1255"></a>
  1264. <span class="sourceLineNo">1256</span> * requested, sends a {@link PlotChangeEvent} to all registered listeners.<a name="line.1256"></a>
  1265. <span class="sourceLineNo">1257</span> * Be aware that if the &lt;code&gt;autoPopulateSectionPaint&lt;/code&gt; flag is set,<a name="line.1257"></a>
  1266. <span class="sourceLineNo">1258</span> * the section paints may be repopulated using the same colours as before.<a name="line.1258"></a>
  1267. <span class="sourceLineNo">1259</span> *<a name="line.1259"></a>
  1268. <span class="sourceLineNo">1260</span> * @param notify notify listeners?<a name="line.1260"></a>
  1269. <span class="sourceLineNo">1261</span> *<a name="line.1261"></a>
  1270. <span class="sourceLineNo">1262</span> * @since 1.0.11<a name="line.1262"></a>
  1271. <span class="sourceLineNo">1263</span> *<a name="line.1263"></a>
  1272. <span class="sourceLineNo">1264</span> * @see #autoPopulateSectionOutlinePaint<a name="line.1264"></a>
  1273. <span class="sourceLineNo">1265</span> */<a name="line.1265"></a>
  1274. <span class="sourceLineNo">1266</span> public void clearSectionOutlinePaints(boolean notify) {<a name="line.1266"></a>
  1275. <span class="sourceLineNo">1267</span> this.sectionOutlinePaintMap.clear();<a name="line.1267"></a>
  1276. <span class="sourceLineNo">1268</span> if (notify) {<a name="line.1268"></a>
  1277. <span class="sourceLineNo">1269</span> fireChangeEvent();<a name="line.1269"></a>
  1278. <span class="sourceLineNo">1270</span> }<a name="line.1270"></a>
  1279. <span class="sourceLineNo">1271</span> }<a name="line.1271"></a>
  1280. <span class="sourceLineNo">1272</span><a name="line.1272"></a>
  1281. <span class="sourceLineNo">1273</span> /**<a name="line.1273"></a>
  1282. <span class="sourceLineNo">1274</span> * Returns the base section paint. This is used when no other paint is<a name="line.1274"></a>
  1283. <span class="sourceLineNo">1275</span> * available.<a name="line.1275"></a>
  1284. <span class="sourceLineNo">1276</span> *<a name="line.1276"></a>
  1285. <span class="sourceLineNo">1277</span> * @return The paint (never &lt;code&gt;null&lt;/code&gt;).<a name="line.1277"></a>
  1286. <span class="sourceLineNo">1278</span> *<a name="line.1278"></a>
  1287. <span class="sourceLineNo">1279</span> * @see #setBaseSectionOutlinePaint(Paint)<a name="line.1279"></a>
  1288. <span class="sourceLineNo">1280</span> */<a name="line.1280"></a>
  1289. <span class="sourceLineNo">1281</span> public Paint getBaseSectionOutlinePaint() {<a name="line.1281"></a>
  1290. <span class="sourceLineNo">1282</span> return this.baseSectionOutlinePaint;<a name="line.1282"></a>
  1291. <span class="sourceLineNo">1283</span> }<a name="line.1283"></a>
  1292. <span class="sourceLineNo">1284</span><a name="line.1284"></a>
  1293. <span class="sourceLineNo">1285</span> /**<a name="line.1285"></a>
  1294. <span class="sourceLineNo">1286</span> * Sets the base section paint.<a name="line.1286"></a>
  1295. <span class="sourceLineNo">1287</span> *<a name="line.1287"></a>
  1296. <span class="sourceLineNo">1288</span> * @param paint the paint (&lt;code&gt;null&lt;/code&gt; not permitted).<a name="line.1288"></a>
  1297. <span class="sourceLineNo">1289</span> *<a name="line.1289"></a>
  1298. <span class="sourceLineNo">1290</span> * @see #getBaseSectionOutlinePaint()<a name="line.1290"></a>
  1299. <span class="sourceLineNo">1291</span> */<a name="line.1291"></a>
  1300. <span class="sourceLineNo">1292</span> public void setBaseSectionOutlinePaint(Paint paint) {<a name="line.1292"></a>
  1301. <span class="sourceLineNo">1293</span> ParamChecks.nullNotPermitted(paint, "paint");<a name="line.1293"></a>
  1302. <span class="sourceLineNo">1294</span> this.baseSectionOutlinePaint = paint;<a name="line.1294"></a>
  1303. <span class="sourceLineNo">1295</span> fireChangeEvent();<a name="line.1295"></a>
  1304. <span class="sourceLineNo">1296</span> }<a name="line.1296"></a>
  1305. <span class="sourceLineNo">1297</span><a name="line.1297"></a>
  1306. <span class="sourceLineNo">1298</span> /**<a name="line.1298"></a>
  1307. <span class="sourceLineNo">1299</span> * Returns the flag that controls whether or not the section outline paint<a name="line.1299"></a>
  1308. <span class="sourceLineNo">1300</span> * is auto-populated by the {@link #lookupSectionOutlinePaint(Comparable)}<a name="line.1300"></a>
  1309. <span class="sourceLineNo">1301</span> * method.<a name="line.1301"></a>
  1310. <span class="sourceLineNo">1302</span> *<a name="line.1302"></a>
  1311. <span class="sourceLineNo">1303</span> * @return A boolean.<a name="line.1303"></a>
  1312. <span class="sourceLineNo">1304</span> *<a name="line.1304"></a>
  1313. <span class="sourceLineNo">1305</span> * @since 1.0.11<a name="line.1305"></a>
  1314. <span class="sourceLineNo">1306</span> */<a name="line.1306"></a>
  1315. <span class="sourceLineNo">1307</span> public boolean getAutoPopulateSectionOutlinePaint() {<a name="line.1307"></a>
  1316. <span class="sourceLineNo">1308</span> return this.autoPopulateSectionOutlinePaint;<a name="line.1308"></a>
  1317. <span class="sourceLineNo">1309</span> }<a name="line.1309"></a>
  1318. <span class="sourceLineNo">1310</span><a name="line.1310"></a>
  1319. <span class="sourceLineNo">1311</span> /**<a name="line.1311"></a>
  1320. <span class="sourceLineNo">1312</span> * Sets the flag that controls whether or not the section outline paint is<a name="line.1312"></a>
  1321. <span class="sourceLineNo">1313</span> * auto-populated by the {@link #lookupSectionOutlinePaint(Comparable)}<a name="line.1313"></a>
  1322. <span class="sourceLineNo">1314</span> * method, and sends a {@link PlotChangeEvent} to all registered listeners.<a name="line.1314"></a>
  1323. <span class="sourceLineNo">1315</span> *<a name="line.1315"></a>
  1324. <span class="sourceLineNo">1316</span> * @param auto auto-populate?<a name="line.1316"></a>
  1325. <span class="sourceLineNo">1317</span> *<a name="line.1317"></a>
  1326. <span class="sourceLineNo">1318</span> * @since 1.0.11<a name="line.1318"></a>
  1327. <span class="sourceLineNo">1319</span> */<a name="line.1319"></a>
  1328. <span class="sourceLineNo">1320</span> public void setAutoPopulateSectionOutlinePaint(boolean auto) {<a name="line.1320"></a>
  1329. <span class="sourceLineNo">1321</span> this.autoPopulateSectionOutlinePaint = auto;<a name="line.1321"></a>
  1330. <span class="sourceLineNo">1322</span> fireChangeEvent();<a name="line.1322"></a>
  1331. <span class="sourceLineNo">1323</span> }<a name="line.1323"></a>
  1332. <span class="sourceLineNo">1324</span><a name="line.1324"></a>
  1333. <span class="sourceLineNo">1325</span> //// SECTION OUTLINE STROKE ///////////////////////////////////////////////<a name="line.1325"></a>
  1334. <span class="sourceLineNo">1326</span><a name="line.1326"></a>
  1335. <span class="sourceLineNo">1327</span> /**<a name="line.1327"></a>
  1336. <span class="sourceLineNo">1328</span> * Returns the outline stroke for the specified section. This is<a name="line.1328"></a>
  1337. <span class="sourceLineNo">1329</span> * equivalent to &lt;code&gt;lookupSectionOutlineStroke(section,<a name="line.1329"></a>
  1338. <span class="sourceLineNo">1330</span> * getAutoPopulateSectionOutlineStroke())&lt;/code&gt;.<a name="line.1330"></a>
  1339. <span class="sourceLineNo">1331</span> *<a name="line.1331"></a>
  1340. <span class="sourceLineNo">1332</span> * @param key the section key.<a name="line.1332"></a>
  1341. <span class="sourceLineNo">1333</span> *<a name="line.1333"></a>
  1342. <span class="sourceLineNo">1334</span> * @return The stroke for the specified section.<a name="line.1334"></a>
  1343. <span class="sourceLineNo">1335</span> *<a name="line.1335"></a>
  1344. <span class="sourceLineNo">1336</span> * @since 1.0.3<a name="line.1336"></a>
  1345. <span class="sourceLineNo">1337</span> *<a name="line.1337"></a>
  1346. <span class="sourceLineNo">1338</span> * @see #lookupSectionOutlineStroke(Comparable, boolean)<a name="line.1338"></a>
  1347. <span class="sourceLineNo">1339</span> */<a name="line.1339"></a>
  1348. <span class="sourceLineNo">1340</span> protected Stroke lookupSectionOutlineStroke(Comparable key) {<a name="line.1340"></a>
  1349. <span class="sourceLineNo">1341</span> return lookupSectionOutlineStroke(key,<a name="line.1341"></a>
  1350. <span class="sourceLineNo">1342</span> getAutoPopulateSectionOutlineStroke());<a name="line.1342"></a>
  1351. <span class="sourceLineNo">1343</span> }<a name="line.1343"></a>
  1352. <span class="sourceLineNo">1344</span><a name="line.1344"></a>
  1353. <span class="sourceLineNo">1345</span> /**<a name="line.1345"></a>
  1354. <span class="sourceLineNo">1346</span> * Returns the outline stroke for the specified section. The lookup<a name="line.1346"></a>
  1355. <span class="sourceLineNo">1347</span> * involves these steps:<a name="line.1347"></a>
  1356. <span class="sourceLineNo">1348</span> * &lt;ul&gt;<a name="line.1348"></a>
  1357. <span class="sourceLineNo">1349</span> * &lt;li&gt;if {@link #getSectionOutlineStroke()} is non-&lt;code&gt;null&lt;/code&gt;,<a name="line.1349"></a>
  1358. <span class="sourceLineNo">1350</span> * return it;&lt;/li&gt;<a name="line.1350"></a>
  1359. <span class="sourceLineNo">1351</span> * &lt;li&gt;otherwise, if {@link #getSectionOutlineStroke(int)} is<a name="line.1351"></a>
  1360. <span class="sourceLineNo">1352</span> * non-&lt;code&gt;null&lt;/code&gt; return it;&lt;/li&gt;<a name="line.1352"></a>
  1361. <span class="sourceLineNo">1353</span> * &lt;li&gt;if {@link #getSectionOutlineStroke(int)} is &lt;code&gt;null&lt;/code&gt; but<a name="line.1353"></a>
  1362. <span class="sourceLineNo">1354</span> * &lt;code&gt;autoPopulate&lt;/code&gt; is &lt;code&gt;true&lt;/code&gt;, attempt to fetch<a name="line.1354"></a>
  1363. <span class="sourceLineNo">1355</span> * a new outline stroke from the drawing supplier<a name="line.1355"></a>
  1364. <span class="sourceLineNo">1356</span> * ({@link #getDrawingSupplier()});<a name="line.1356"></a>
  1365. <span class="sourceLineNo">1357</span> * &lt;li&gt;if all else fails, return {@link #getBaseSectionOutlineStroke()}.<a name="line.1357"></a>
  1366. <span class="sourceLineNo">1358</span> * &lt;/ul&gt;<a name="line.1358"></a>
  1367. <span class="sourceLineNo">1359</span> *<a name="line.1359"></a>
  1368. <span class="sourceLineNo">1360</span> * @param key the section key.<a name="line.1360"></a>
  1369. <span class="sourceLineNo">1361</span> * @param autoPopulate a flag that controls whether the drawing supplier<a name="line.1361"></a>
  1370. <span class="sourceLineNo">1362</span> * is used to auto-populate the section outline stroke settings.<a name="line.1362"></a>
  1371. <span class="sourceLineNo">1363</span> *<a name="line.1363"></a>
  1372. <span class="sourceLineNo">1364</span> * @return The stroke.<a name="line.1364"></a>
  1373. <span class="sourceLineNo">1365</span> *<a name="line.1365"></a>
  1374. <span class="sourceLineNo">1366</span> * @since 1.0.3<a name="line.1366"></a>
  1375. <span class="sourceLineNo">1367</span> */<a name="line.1367"></a>
  1376. <span class="sourceLineNo">1368</span> protected Stroke lookupSectionOutlineStroke(Comparable key,<a name="line.1368"></a>
  1377. <span class="sourceLineNo">1369</span> boolean autoPopulate) {<a name="line.1369"></a>
  1378. <span class="sourceLineNo">1370</span><a name="line.1370"></a>
  1379. <span class="sourceLineNo">1371</span> // is there an override?<a name="line.1371"></a>
  1380. <span class="sourceLineNo">1372</span> Stroke result = getSectionOutlineStroke();<a name="line.1372"></a>
  1381. <span class="sourceLineNo">1373</span> if (result != null) {<a name="line.1373"></a>
  1382. <span class="sourceLineNo">1374</span> return result;<a name="line.1374"></a>
  1383. <span class="sourceLineNo">1375</span> }<a name="line.1375"></a>
  1384. <span class="sourceLineNo">1376</span><a name="line.1376"></a>
  1385. <span class="sourceLineNo">1377</span> // if not, check if there is a stroke defined for the specified key<a name="line.1377"></a>
  1386. <span class="sourceLineNo">1378</span> result = this.sectionOutlineStrokeMap.getStroke(key);<a name="line.1378"></a>
  1387. <span class="sourceLineNo">1379</span> if (result != null) {<a name="line.1379"></a>
  1388. <span class="sourceLineNo">1380</span> return result;<a name="line.1380"></a>
  1389. <span class="sourceLineNo">1381</span> }<a name="line.1381"></a>
  1390. <span class="sourceLineNo">1382</span><a name="line.1382"></a>
  1391. <span class="sourceLineNo">1383</span> // nothing defined - do we autoPopulate?<a name="line.1383"></a>
  1392. <span class="sourceLineNo">1384</span> if (autoPopulate) {<a name="line.1384"></a>
  1393. <span class="sourceLineNo">1385</span> DrawingSupplier ds = getDrawingSupplier();<a name="line.1385"></a>
  1394. <span class="sourceLineNo">1386</span> if (ds != null) {<a name="line.1386"></a>
  1395. <span class="sourceLineNo">1387</span> result = ds.getNextOutlineStroke();<a name="line.1387"></a>
  1396. <span class="sourceLineNo">1388</span> this.sectionOutlineStrokeMap.put(key, result);<a name="line.1388"></a>
  1397. <span class="sourceLineNo">1389</span> }<a name="line.1389"></a>
  1398. <span class="sourceLineNo">1390</span> else {<a name="line.1390"></a>
  1399. <span class="sourceLineNo">1391</span> result = this.baseSectionOutlineStroke;<a name="line.1391"></a>
  1400. <span class="sourceLineNo">1392</span> }<a name="line.1392"></a>
  1401. <span class="sourceLineNo">1393</span> }<a name="line.1393"></a>
  1402. <span class="sourceLineNo">1394</span> else {<a name="line.1394"></a>
  1403. <span class="sourceLineNo">1395</span> result = this.baseSectionOutlineStroke;<a name="line.1395"></a>
  1404. <span class="sourceLineNo">1396</span> }<a name="line.1396"></a>
  1405. <span class="sourceLineNo">1397</span> return result;<a name="line.1397"></a>
  1406. <span class="sourceLineNo">1398</span> }<a name="line.1398"></a>
  1407. <span class="sourceLineNo">1399</span><a name="line.1399"></a>
  1408. <span class="sourceLineNo">1400</span> /**<a name="line.1400"></a>
  1409. <span class="sourceLineNo">1401</span> * Returns the outline stroke associated with the specified key, or<a name="line.1401"></a>
  1410. <span class="sourceLineNo">1402</span> * &lt;code&gt;null&lt;/code&gt; if there is no stroke associated with the key.<a name="line.1402"></a>
  1411. <span class="sourceLineNo">1403</span> *<a name="line.1403"></a>
  1412. <span class="sourceLineNo">1404</span> * @param key the key (&lt;code&gt;null&lt;/code&gt; not permitted).<a name="line.1404"></a>
  1413. <span class="sourceLineNo">1405</span> *<a name="line.1405"></a>
  1414. <span class="sourceLineNo">1406</span> * @return The stroke associated with the specified key, or<a name="line.1406"></a>
  1415. <span class="sourceLineNo">1407</span> * &lt;code&gt;null&lt;/code&gt;.<a name="line.1407"></a>
  1416. <span class="sourceLineNo">1408</span> *<a name="line.1408"></a>
  1417. <span class="sourceLineNo">1409</span> * @throws IllegalArgumentException if &lt;code&gt;key&lt;/code&gt; is<a name="line.1409"></a>
  1418. <span class="sourceLineNo">1410</span> * &lt;code&gt;null&lt;/code&gt;.<a name="line.1410"></a>
  1419. <span class="sourceLineNo">1411</span> *<a name="line.1411"></a>
  1420. <span class="sourceLineNo">1412</span> * @see #setSectionOutlineStroke(Comparable, Stroke)<a name="line.1412"></a>
  1421. <span class="sourceLineNo">1413</span> *<a name="line.1413"></a>
  1422. <span class="sourceLineNo">1414</span> * @since 1.0.3<a name="line.1414"></a>
  1423. <span class="sourceLineNo">1415</span> */<a name="line.1415"></a>
  1424. <span class="sourceLineNo">1416</span> public Stroke getSectionOutlineStroke(Comparable key) {<a name="line.1416"></a>
  1425. <span class="sourceLineNo">1417</span> // null argument check delegated...<a name="line.1417"></a>
  1426. <span class="sourceLineNo">1418</span> return this.sectionOutlineStrokeMap.getStroke(key);<a name="line.1418"></a>
  1427. <span class="sourceLineNo">1419</span> }<a name="line.1419"></a>
  1428. <span class="sourceLineNo">1420</span><a name="line.1420"></a>
  1429. <span class="sourceLineNo">1421</span> /**<a name="line.1421"></a>
  1430. <span class="sourceLineNo">1422</span> * Sets the outline stroke associated with the specified key, and sends a<a name="line.1422"></a>
  1431. <span class="sourceLineNo">1423</span> * {@link PlotChangeEvent} to all registered listeners.<a name="line.1423"></a>
  1432. <span class="sourceLineNo">1424</span> *<a name="line.1424"></a>
  1433. <span class="sourceLineNo">1425</span> * @param key the key (&lt;code&gt;null&lt;/code&gt; not permitted).<a name="line.1425"></a>
  1434. <span class="sourceLineNo">1426</span> * @param stroke the stroke.<a name="line.1426"></a>
  1435. <span class="sourceLineNo">1427</span> *<a name="line.1427"></a>
  1436. <span class="sourceLineNo">1428</span> * @throws IllegalArgumentException if &lt;code&gt;key&lt;/code&gt; is<a name="line.1428"></a>
  1437. <span class="sourceLineNo">1429</span> * &lt;code&gt;null&lt;/code&gt;.<a name="line.1429"></a>
  1438. <span class="sourceLineNo">1430</span> *<a name="line.1430"></a>
  1439. <span class="sourceLineNo">1431</span> * @see #getSectionOutlineStroke(Comparable)<a name="line.1431"></a>
  1440. <span class="sourceLineNo">1432</span> *<a name="line.1432"></a>
  1441. <span class="sourceLineNo">1433</span> * @since 1.0.3<a name="line.1433"></a>
  1442. <span class="sourceLineNo">1434</span> */<a name="line.1434"></a>
  1443. <span class="sourceLineNo">1435</span> public void setSectionOutlineStroke(Comparable key, Stroke stroke) {<a name="line.1435"></a>
  1444. <span class="sourceLineNo">1436</span> // null argument check delegated...<a name="line.1436"></a>
  1445. <span class="sourceLineNo">1437</span> this.sectionOutlineStrokeMap.put(key, stroke);<a name="line.1437"></a>
  1446. <span class="sourceLineNo">1438</span> fireChangeEvent();<a name="line.1438"></a>
  1447. <span class="sourceLineNo">1439</span> }<a name="line.1439"></a>
  1448. <span class="sourceLineNo">1440</span><a name="line.1440"></a>
  1449. <span class="sourceLineNo">1441</span> /**<a name="line.1441"></a>
  1450. <span class="sourceLineNo">1442</span> * Clears the section outline stroke settings for this plot and, if<a name="line.1442"></a>
  1451. <span class="sourceLineNo">1443</span> * requested, sends a {@link PlotChangeEvent} to all registered listeners.<a name="line.1443"></a>
  1452. <span class="sourceLineNo">1444</span> * Be aware that if the &lt;code&gt;autoPopulateSectionPaint&lt;/code&gt; flag is set,<a name="line.1444"></a>
  1453. <span class="sourceLineNo">1445</span> * the section paints may be repopulated using the same colours as before.<a name="line.1445"></a>
  1454. <span class="sourceLineNo">1446</span> *<a name="line.1446"></a>
  1455. <span class="sourceLineNo">1447</span> * @param notify notify listeners?<a name="line.1447"></a>
  1456. <span class="sourceLineNo">1448</span> *<a name="line.1448"></a>
  1457. <span class="sourceLineNo">1449</span> * @since 1.0.11<a name="line.1449"></a>
  1458. <span class="sourceLineNo">1450</span> *<a name="line.1450"></a>
  1459. <span class="sourceLineNo">1451</span> * @see #autoPopulateSectionOutlineStroke<a name="line.1451"></a>
  1460. <span class="sourceLineNo">1452</span> */<a name="line.1452"></a>
  1461. <span class="sourceLineNo">1453</span> public void clearSectionOutlineStrokes(boolean notify) {<a name="line.1453"></a>
  1462. <span class="sourceLineNo">1454</span> this.sectionOutlineStrokeMap.clear();<a name="line.1454"></a>
  1463. <span class="sourceLineNo">1455</span> if (notify) {<a name="line.1455"></a>
  1464. <span class="sourceLineNo">1456</span> fireChangeEvent();<a name="line.1456"></a>
  1465. <span class="sourceLineNo">1457</span> }<a name="line.1457"></a>
  1466. <span class="sourceLineNo">1458</span> }<a name="line.1458"></a>
  1467. <span class="sourceLineNo">1459</span><a name="line.1459"></a>
  1468. <span class="sourceLineNo">1460</span> /**<a name="line.1460"></a>
  1469. <span class="sourceLineNo">1461</span> * Returns the base section stroke. This is used when no other stroke is<a name="line.1461"></a>
  1470. <span class="sourceLineNo">1462</span> * available.<a name="line.1462"></a>
  1471. <span class="sourceLineNo">1463</span> *<a name="line.1463"></a>
  1472. <span class="sourceLineNo">1464</span> * @return The stroke (never &lt;code&gt;null&lt;/code&gt;).<a name="line.1464"></a>
  1473. <span class="sourceLineNo">1465</span> *<a name="line.1465"></a>
  1474. <span class="sourceLineNo">1466</span> * @see #setBaseSectionOutlineStroke(Stroke)<a name="line.1466"></a>
  1475. <span class="sourceLineNo">1467</span> */<a name="line.1467"></a>
  1476. <span class="sourceLineNo">1468</span> public Stroke getBaseSectionOutlineStroke() {<a name="line.1468"></a>
  1477. <span class="sourceLineNo">1469</span> return this.baseSectionOutlineStroke;<a name="line.1469"></a>
  1478. <span class="sourceLineNo">1470</span> }<a name="line.1470"></a>
  1479. <span class="sourceLineNo">1471</span><a name="line.1471"></a>
  1480. <span class="sourceLineNo">1472</span> /**<a name="line.1472"></a>
  1481. <span class="sourceLineNo">1473</span> * Sets the base section stroke.<a name="line.1473"></a>
  1482. <span class="sourceLineNo">1474</span> *<a name="line.1474"></a>
  1483. <span class="sourceLineNo">1475</span> * @param stroke the stroke (&lt;code&gt;null&lt;/code&gt; not permitted).<a name="line.1475"></a>
  1484. <span class="sourceLineNo">1476</span> *<a name="line.1476"></a>
  1485. <span class="sourceLineNo">1477</span> * @see #getBaseSectionOutlineStroke()<a name="line.1477"></a>
  1486. <span class="sourceLineNo">1478</span> */<a name="line.1478"></a>
  1487. <span class="sourceLineNo">1479</span> public void setBaseSectionOutlineStroke(Stroke stroke) {<a name="line.1479"></a>
  1488. <span class="sourceLineNo">1480</span> ParamChecks.nullNotPermitted(stroke, "stroke");<a name="line.1480"></a>
  1489. <span class="sourceLineNo">1481</span> this.baseSectionOutlineStroke = stroke;<a name="line.1481"></a>
  1490. <span class="sourceLineNo">1482</span> fireChangeEvent();<a name="line.1482"></a>
  1491. <span class="sourceLineNo">1483</span> }<a name="line.1483"></a>
  1492. <span class="sourceLineNo">1484</span><a name="line.1484"></a>
  1493. <span class="sourceLineNo">1485</span> /**<a name="line.1485"></a>
  1494. <span class="sourceLineNo">1486</span> * Returns the flag that controls whether or not the section outline stroke<a name="line.1486"></a>
  1495. <span class="sourceLineNo">1487</span> * is auto-populated by the {@link #lookupSectionOutlinePaint(Comparable)}<a name="line.1487"></a>
  1496. <span class="sourceLineNo">1488</span> * method.<a name="line.1488"></a>
  1497. <span class="sourceLineNo">1489</span> *<a name="line.1489"></a>
  1498. <span class="sourceLineNo">1490</span> * @return A boolean.<a name="line.1490"></a>
  1499. <span class="sourceLineNo">1491</span> *<a name="line.1491"></a>
  1500. <span class="sourceLineNo">1492</span> * @since 1.0.11<a name="line.1492"></a>
  1501. <span class="sourceLineNo">1493</span> */<a name="line.1493"></a>
  1502. <span class="sourceLineNo">1494</span> public boolean getAutoPopulateSectionOutlineStroke() {<a name="line.1494"></a>
  1503. <span class="sourceLineNo">1495</span> return this.autoPopulateSectionOutlineStroke;<a name="line.1495"></a>
  1504. <span class="sourceLineNo">1496</span> }<a name="line.1496"></a>
  1505. <span class="sourceLineNo">1497</span><a name="line.1497"></a>
  1506. <span class="sourceLineNo">1498</span> /**<a name="line.1498"></a>
  1507. <span class="sourceLineNo">1499</span> * Sets the flag that controls whether or not the section outline stroke is<a name="line.1499"></a>
  1508. <span class="sourceLineNo">1500</span> * auto-populated by the {@link #lookupSectionOutlineStroke(Comparable)}<a name="line.1500"></a>
  1509. <span class="sourceLineNo">1501</span> * method, and sends a {@link PlotChangeEvent} to all registered listeners.<a name="line.1501"></a>
  1510. <span class="sourceLineNo">1502</span> *<a name="line.1502"></a>
  1511. <span class="sourceLineNo">1503</span> * @param auto auto-populate?<a name="line.1503"></a>
  1512. <span class="sourceLineNo">1504</span> *<a name="line.1504"></a>
  1513. <span class="sourceLineNo">1505</span> * @since 1.0.11<a name="line.1505"></a>
  1514. <span class="sourceLineNo">1506</span> */<a name="line.1506"></a>
  1515. <span class="sourceLineNo">1507</span> public void setAutoPopulateSectionOutlineStroke(boolean auto) {<a name="line.1507"></a>
  1516. <span class="sourceLineNo">1508</span> this.autoPopulateSectionOutlineStroke = auto;<a name="line.1508"></a>
  1517. <span class="sourceLineNo">1509</span> fireChangeEvent();<a name="line.1509"></a>
  1518. <span class="sourceLineNo">1510</span> }<a name="line.1510"></a>
  1519. <span class="sourceLineNo">1511</span><a name="line.1511"></a>
  1520. <span class="sourceLineNo">1512</span> /**<a name="line.1512"></a>
  1521. <span class="sourceLineNo">1513</span> * Returns the shadow paint.<a name="line.1513"></a>
  1522. <span class="sourceLineNo">1514</span> *<a name="line.1514"></a>
  1523. <span class="sourceLineNo">1515</span> * @return The paint (possibly &lt;code&gt;null&lt;/code&gt;).<a name="line.1515"></a>
  1524. <span class="sourceLineNo">1516</span> *<a name="line.1516"></a>
  1525. <span class="sourceLineNo">1517</span> * @see #setShadowPaint(Paint)<a name="line.1517"></a>
  1526. <span class="sourceLineNo">1518</span> */<a name="line.1518"></a>
  1527. <span class="sourceLineNo">1519</span> public Paint getShadowPaint() {<a name="line.1519"></a>
  1528. <span class="sourceLineNo">1520</span> return this.shadowPaint;<a name="line.1520"></a>
  1529. <span class="sourceLineNo">1521</span> }<a name="line.1521"></a>
  1530. <span class="sourceLineNo">1522</span><a name="line.1522"></a>
  1531. <span class="sourceLineNo">1523</span> /**<a name="line.1523"></a>
  1532. <span class="sourceLineNo">1524</span> * Sets the shadow paint and sends a {@link PlotChangeEvent} to all<a name="line.1524"></a>
  1533. <span class="sourceLineNo">1525</span> * registered listeners.<a name="line.1525"></a>
  1534. <span class="sourceLineNo">1526</span> *<a name="line.1526"></a>
  1535. <span class="sourceLineNo">1527</span> * @param paint the paint (&lt;code&gt;null&lt;/code&gt; permitted).<a name="line.1527"></a>
  1536. <span class="sourceLineNo">1528</span> *<a name="line.1528"></a>
  1537. <span class="sourceLineNo">1529</span> * @see #getShadowPaint()<a name="line.1529"></a>
  1538. <span class="sourceLineNo">1530</span> */<a name="line.1530"></a>
  1539. <span class="sourceLineNo">1531</span> public void setShadowPaint(Paint paint) {<a name="line.1531"></a>
  1540. <span class="sourceLineNo">1532</span> this.shadowPaint = paint;<a name="line.1532"></a>
  1541. <span class="sourceLineNo">1533</span> fireChangeEvent();<a name="line.1533"></a>
  1542. <span class="sourceLineNo">1534</span> }<a name="line.1534"></a>
  1543. <span class="sourceLineNo">1535</span><a name="line.1535"></a>
  1544. <span class="sourceLineNo">1536</span> /**<a name="line.1536"></a>
  1545. <span class="sourceLineNo">1537</span> * Returns the x-offset for the shadow effect.<a name="line.1537"></a>
  1546. <span class="sourceLineNo">1538</span> *<a name="line.1538"></a>
  1547. <span class="sourceLineNo">1539</span> * @return The offset (in Java2D units).<a name="line.1539"></a>
  1548. <span class="sourceLineNo">1540</span> *<a name="line.1540"></a>
  1549. <span class="sourceLineNo">1541</span> * @see #setShadowXOffset(double)<a name="line.1541"></a>
  1550. <span class="sourceLineNo">1542</span> */<a name="line.1542"></a>
  1551. <span class="sourceLineNo">1543</span> public double getShadowXOffset() {<a name="line.1543"></a>
  1552. <span class="sourceLineNo">1544</span> return this.shadowXOffset;<a name="line.1544"></a>
  1553. <span class="sourceLineNo">1545</span> }<a name="line.1545"></a>
  1554. <span class="sourceLineNo">1546</span><a name="line.1546"></a>
  1555. <span class="sourceLineNo">1547</span> /**<a name="line.1547"></a>
  1556. <span class="sourceLineNo">1548</span> * Sets the x-offset for the shadow effect and sends a<a name="line.1548"></a>
  1557. <span class="sourceLineNo">1549</span> * {@link PlotChangeEvent} to all registered listeners.<a name="line.1549"></a>
  1558. <span class="sourceLineNo">1550</span> *<a name="line.1550"></a>
  1559. <span class="sourceLineNo">1551</span> * @param offset the offset (in Java2D units).<a name="line.1551"></a>
  1560. <span class="sourceLineNo">1552</span> *<a name="line.1552"></a>
  1561. <span class="sourceLineNo">1553</span> * @see #getShadowXOffset()<a name="line.1553"></a>
  1562. <span class="sourceLineNo">1554</span> */<a name="line.1554"></a>
  1563. <span class="sourceLineNo">1555</span> public void setShadowXOffset(double offset) {<a name="line.1555"></a>
  1564. <span class="sourceLineNo">1556</span> this.shadowXOffset = offset;<a name="line.1556"></a>
  1565. <span class="sourceLineNo">1557</span> fireChangeEvent();<a name="line.1557"></a>
  1566. <span class="sourceLineNo">1558</span> }<a name="line.1558"></a>
  1567. <span class="sourceLineNo">1559</span><a name="line.1559"></a>
  1568. <span class="sourceLineNo">1560</span> /**<a name="line.1560"></a>
  1569. <span class="sourceLineNo">1561</span> * Returns the y-offset for the shadow effect.<a name="line.1561"></a>
  1570. <span class="sourceLineNo">1562</span> *<a name="line.1562"></a>
  1571. <span class="sourceLineNo">1563</span> * @return The offset (in Java2D units).<a name="line.1563"></a>
  1572. <span class="sourceLineNo">1564</span> *<a name="line.1564"></a>
  1573. <span class="sourceLineNo">1565</span> * @see #setShadowYOffset(double)<a name="line.1565"></a>
  1574. <span class="sourceLineNo">1566</span> */<a name="line.1566"></a>
  1575. <span class="sourceLineNo">1567</span> public double getShadowYOffset() {<a name="line.1567"></a>
  1576. <span class="sourceLineNo">1568</span> return this.shadowYOffset;<a name="line.1568"></a>
  1577. <span class="sourceLineNo">1569</span> }<a name="line.1569"></a>
  1578. <span class="sourceLineNo">1570</span><a name="line.1570"></a>
  1579. <span class="sourceLineNo">1571</span> /**<a name="line.1571"></a>
  1580. <span class="sourceLineNo">1572</span> * Sets the y-offset for the shadow effect and sends a<a name="line.1572"></a>
  1581. <span class="sourceLineNo">1573</span> * {@link PlotChangeEvent} to all registered listeners.<a name="line.1573"></a>
  1582. <span class="sourceLineNo">1574</span> *<a name="line.1574"></a>
  1583. <span class="sourceLineNo">1575</span> * @param offset the offset (in Java2D units).<a name="line.1575"></a>
  1584. <span class="sourceLineNo">1576</span> *<a name="line.1576"></a>
  1585. <span class="sourceLineNo">1577</span> * @see #getShadowYOffset()<a name="line.1577"></a>
  1586. <span class="sourceLineNo">1578</span> */<a name="line.1578"></a>
  1587. <span class="sourceLineNo">1579</span> public void setShadowYOffset(double offset) {<a name="line.1579"></a>
  1588. <span class="sourceLineNo">1580</span> this.shadowYOffset = offset;<a name="line.1580"></a>
  1589. <span class="sourceLineNo">1581</span> fireChangeEvent();<a name="line.1581"></a>
  1590. <span class="sourceLineNo">1582</span> }<a name="line.1582"></a>
  1591. <span class="sourceLineNo">1583</span><a name="line.1583"></a>
  1592. <span class="sourceLineNo">1584</span> /**<a name="line.1584"></a>
  1593. <span class="sourceLineNo">1585</span> * Returns the amount that the section with the specified key should be<a name="line.1585"></a>
  1594. <span class="sourceLineNo">1586</span> * exploded.<a name="line.1586"></a>
  1595. <span class="sourceLineNo">1587</span> *<a name="line.1587"></a>
  1596. <span class="sourceLineNo">1588</span> * @param key the key (&lt;code&gt;null&lt;/code&gt; not permitted).<a name="line.1588"></a>
  1597. <span class="sourceLineNo">1589</span> *<a name="line.1589"></a>
  1598. <span class="sourceLineNo">1590</span> * @return The amount that the section with the specified key should be<a name="line.1590"></a>
  1599. <span class="sourceLineNo">1591</span> * exploded.<a name="line.1591"></a>
  1600. <span class="sourceLineNo">1592</span> *<a name="line.1592"></a>
  1601. <span class="sourceLineNo">1593</span> * @throws IllegalArgumentException if &lt;code&gt;key&lt;/code&gt; is<a name="line.1593"></a>
  1602. <span class="sourceLineNo">1594</span> * &lt;code&gt;null&lt;/code&gt;.<a name="line.1594"></a>
  1603. <span class="sourceLineNo">1595</span> *<a name="line.1595"></a>
  1604. <span class="sourceLineNo">1596</span> * @since 1.0.3<a name="line.1596"></a>
  1605. <span class="sourceLineNo">1597</span> *<a name="line.1597"></a>
  1606. <span class="sourceLineNo">1598</span> * @see #setExplodePercent(Comparable, double)<a name="line.1598"></a>
  1607. <span class="sourceLineNo">1599</span> */<a name="line.1599"></a>
  1608. <span class="sourceLineNo">1600</span> public double getExplodePercent(Comparable key) {<a name="line.1600"></a>
  1609. <span class="sourceLineNo">1601</span> double result = 0.0;<a name="line.1601"></a>
  1610. <span class="sourceLineNo">1602</span> if (this.explodePercentages != null) {<a name="line.1602"></a>
  1611. <span class="sourceLineNo">1603</span> Number percent = (Number) this.explodePercentages.get(key);<a name="line.1603"></a>
  1612. <span class="sourceLineNo">1604</span> if (percent != null) {<a name="line.1604"></a>
  1613. <span class="sourceLineNo">1605</span> result = percent.doubleValue();<a name="line.1605"></a>
  1614. <span class="sourceLineNo">1606</span> }<a name="line.1606"></a>
  1615. <span class="sourceLineNo">1607</span> }<a name="line.1607"></a>
  1616. <span class="sourceLineNo">1608</span> return result;<a name="line.1608"></a>
  1617. <span class="sourceLineNo">1609</span> }<a name="line.1609"></a>
  1618. <span class="sourceLineNo">1610</span><a name="line.1610"></a>
  1619. <span class="sourceLineNo">1611</span> /**<a name="line.1611"></a>
  1620. <span class="sourceLineNo">1612</span> * Sets the amount that a pie section should be exploded and sends a<a name="line.1612"></a>
  1621. <span class="sourceLineNo">1613</span> * {@link PlotChangeEvent} to all registered listeners.<a name="line.1613"></a>
  1622. <span class="sourceLineNo">1614</span> *<a name="line.1614"></a>
  1623. <span class="sourceLineNo">1615</span> * @param key the section key (&lt;code&gt;null&lt;/code&gt; not permitted).<a name="line.1615"></a>
  1624. <span class="sourceLineNo">1616</span> * @param percent the explode percentage (0.30 = 30 percent).<a name="line.1616"></a>
  1625. <span class="sourceLineNo">1617</span> *<a name="line.1617"></a>
  1626. <span class="sourceLineNo">1618</span> * @since 1.0.3<a name="line.1618"></a>
  1627. <span class="sourceLineNo">1619</span> *<a name="line.1619"></a>
  1628. <span class="sourceLineNo">1620</span> * @see #getExplodePercent(Comparable)<a name="line.1620"></a>
  1629. <span class="sourceLineNo">1621</span> */<a name="line.1621"></a>
  1630. <span class="sourceLineNo">1622</span> public void setExplodePercent(Comparable key, double percent) {<a name="line.1622"></a>
  1631. <span class="sourceLineNo">1623</span> ParamChecks.nullNotPermitted(key, "key");<a name="line.1623"></a>
  1632. <span class="sourceLineNo">1624</span> if (this.explodePercentages == null) {<a name="line.1624"></a>
  1633. <span class="sourceLineNo">1625</span> this.explodePercentages = new TreeMap();<a name="line.1625"></a>
  1634. <span class="sourceLineNo">1626</span> }<a name="line.1626"></a>
  1635. <span class="sourceLineNo">1627</span> this.explodePercentages.put(key, new Double(percent));<a name="line.1627"></a>
  1636. <span class="sourceLineNo">1628</span> fireChangeEvent();<a name="line.1628"></a>
  1637. <span class="sourceLineNo">1629</span> }<a name="line.1629"></a>
  1638. <span class="sourceLineNo">1630</span><a name="line.1630"></a>
  1639. <span class="sourceLineNo">1631</span> /**<a name="line.1631"></a>
  1640. <span class="sourceLineNo">1632</span> * Returns the maximum explode percent.<a name="line.1632"></a>
  1641. <span class="sourceLineNo">1633</span> *<a name="line.1633"></a>
  1642. <span class="sourceLineNo">1634</span> * @return The percent.<a name="line.1634"></a>
  1643. <span class="sourceLineNo">1635</span> */<a name="line.1635"></a>
  1644. <span class="sourceLineNo">1636</span> public double getMaximumExplodePercent() {<a name="line.1636"></a>
  1645. <span class="sourceLineNo">1637</span> if (this.dataset == null) {<a name="line.1637"></a>
  1646. <span class="sourceLineNo">1638</span> return 0.0;<a name="line.1638"></a>
  1647. <span class="sourceLineNo">1639</span> }<a name="line.1639"></a>
  1648. <span class="sourceLineNo">1640</span> double result = 0.0;<a name="line.1640"></a>
  1649. <span class="sourceLineNo">1641</span> Iterator iterator = this.dataset.getKeys().iterator();<a name="line.1641"></a>
  1650. <span class="sourceLineNo">1642</span> while (iterator.hasNext()) {<a name="line.1642"></a>
  1651. <span class="sourceLineNo">1643</span> Comparable key = (Comparable) iterator.next();<a name="line.1643"></a>
  1652. <span class="sourceLineNo">1644</span> Number explode = (Number) this.explodePercentages.get(key);<a name="line.1644"></a>
  1653. <span class="sourceLineNo">1645</span> if (explode != null) {<a name="line.1645"></a>
  1654. <span class="sourceLineNo">1646</span> result = Math.max(result, explode.doubleValue());<a name="line.1646"></a>
  1655. <span class="sourceLineNo">1647</span> }<a name="line.1647"></a>
  1656. <span class="sourceLineNo">1648</span> }<a name="line.1648"></a>
  1657. <span class="sourceLineNo">1649</span> return result;<a name="line.1649"></a>
  1658. <span class="sourceLineNo">1650</span> }<a name="line.1650"></a>
  1659. <span class="sourceLineNo">1651</span><a name="line.1651"></a>
  1660. <span class="sourceLineNo">1652</span> /**<a name="line.1652"></a>
  1661. <span class="sourceLineNo">1653</span> * Returns the section label generator.<a name="line.1653"></a>
  1662. <span class="sourceLineNo">1654</span> *<a name="line.1654"></a>
  1663. <span class="sourceLineNo">1655</span> * @return The generator (possibly &lt;code&gt;null&lt;/code&gt;).<a name="line.1655"></a>
  1664. <span class="sourceLineNo">1656</span> *<a name="line.1656"></a>
  1665. <span class="sourceLineNo">1657</span> * @see #setLabelGenerator(PieSectionLabelGenerator)<a name="line.1657"></a>
  1666. <span class="sourceLineNo">1658</span> */<a name="line.1658"></a>
  1667. <span class="sourceLineNo">1659</span> public PieSectionLabelGenerator getLabelGenerator() {<a name="line.1659"></a>
  1668. <span class="sourceLineNo">1660</span> return this.labelGenerator;<a name="line.1660"></a>
  1669. <span class="sourceLineNo">1661</span> }<a name="line.1661"></a>
  1670. <span class="sourceLineNo">1662</span><a name="line.1662"></a>
  1671. <span class="sourceLineNo">1663</span> /**<a name="line.1663"></a>
  1672. <span class="sourceLineNo">1664</span> * Sets the section label generator and sends a {@link PlotChangeEvent} to<a name="line.1664"></a>
  1673. <span class="sourceLineNo">1665</span> * all registered listeners.<a name="line.1665"></a>
  1674. <span class="sourceLineNo">1666</span> *<a name="line.1666"></a>
  1675. <span class="sourceLineNo">1667</span> * @param generator the generator (&lt;code&gt;null&lt;/code&gt; permitted).<a name="line.1667"></a>
  1676. <span class="sourceLineNo">1668</span> *<a name="line.1668"></a>
  1677. <span class="sourceLineNo">1669</span> * @see #getLabelGenerator()<a name="line.1669"></a>
  1678. <span class="sourceLineNo">1670</span> */<a name="line.1670"></a>
  1679. <span class="sourceLineNo">1671</span> public void setLabelGenerator(PieSectionLabelGenerator generator) {<a name="line.1671"></a>
  1680. <span class="sourceLineNo">1672</span> this.labelGenerator = generator;<a name="line.1672"></a>
  1681. <span class="sourceLineNo">1673</span> fireChangeEvent();<a name="line.1673"></a>
  1682. <span class="sourceLineNo">1674</span> }<a name="line.1674"></a>
  1683. <span class="sourceLineNo">1675</span><a name="line.1675"></a>
  1684. <span class="sourceLineNo">1676</span> /**<a name="line.1676"></a>
  1685. <span class="sourceLineNo">1677</span> * Returns the gap between the edge of the pie and the labels, expressed as<a name="line.1677"></a>
  1686. <span class="sourceLineNo">1678</span> * a percentage of the plot width.<a name="line.1678"></a>
  1687. <span class="sourceLineNo">1679</span> *<a name="line.1679"></a>
  1688. <span class="sourceLineNo">1680</span> * @return The gap (a percentage, where 0.05 = five percent).<a name="line.1680"></a>
  1689. <span class="sourceLineNo">1681</span> *<a name="line.1681"></a>
  1690. <span class="sourceLineNo">1682</span> * @see #setLabelGap(double)<a name="line.1682"></a>
  1691. <span class="sourceLineNo">1683</span> */<a name="line.1683"></a>
  1692. <span class="sourceLineNo">1684</span> public double getLabelGap() {<a name="line.1684"></a>
  1693. <span class="sourceLineNo">1685</span> return this.labelGap;<a name="line.1685"></a>
  1694. <span class="sourceLineNo">1686</span> }<a name="line.1686"></a>
  1695. <span class="sourceLineNo">1687</span><a name="line.1687"></a>
  1696. <span class="sourceLineNo">1688</span> /**<a name="line.1688"></a>
  1697. <span class="sourceLineNo">1689</span> * Sets the gap between the edge of the pie and the labels (expressed as a<a name="line.1689"></a>
  1698. <span class="sourceLineNo">1690</span> * percentage of the plot width) and sends a {@link PlotChangeEvent} to all<a name="line.1690"></a>
  1699. <span class="sourceLineNo">1691</span> * registered listeners.<a name="line.1691"></a>
  1700. <span class="sourceLineNo">1692</span> *<a name="line.1692"></a>
  1701. <span class="sourceLineNo">1693</span> * @param gap the gap (a percentage, where 0.05 = five percent).<a name="line.1693"></a>
  1702. <span class="sourceLineNo">1694</span> *<a name="line.1694"></a>
  1703. <span class="sourceLineNo">1695</span> * @see #getLabelGap()<a name="line.1695"></a>
  1704. <span class="sourceLineNo">1696</span> */<a name="line.1696"></a>
  1705. <span class="sourceLineNo">1697</span> public void setLabelGap(double gap) {<a name="line.1697"></a>
  1706. <span class="sourceLineNo">1698</span> this.labelGap = gap;<a name="line.1698"></a>
  1707. <span class="sourceLineNo">1699</span> fireChangeEvent();<a name="line.1699"></a>
  1708. <span class="sourceLineNo">1700</span> }<a name="line.1700"></a>
  1709. <span class="sourceLineNo">1701</span><a name="line.1701"></a>
  1710. <span class="sourceLineNo">1702</span> /**<a name="line.1702"></a>
  1711. <span class="sourceLineNo">1703</span> * Returns the maximum label width as a percentage of the plot width.<a name="line.1703"></a>
  1712. <span class="sourceLineNo">1704</span> *<a name="line.1704"></a>
  1713. <span class="sourceLineNo">1705</span> * @return The width (a percentage, where 0.20 = 20 percent).<a name="line.1705"></a>
  1714. <span class="sourceLineNo">1706</span> *<a name="line.1706"></a>
  1715. <span class="sourceLineNo">1707</span> * @see #setMaximumLabelWidth(double)<a name="line.1707"></a>
  1716. <span class="sourceLineNo">1708</span> */<a name="line.1708"></a>
  1717. <span class="sourceLineNo">1709</span> public double getMaximumLabelWidth() {<a name="line.1709"></a>
  1718. <span class="sourceLineNo">1710</span> return this.maximumLabelWidth;<a name="line.1710"></a>
  1719. <span class="sourceLineNo">1711</span> }<a name="line.1711"></a>
  1720. <span class="sourceLineNo">1712</span><a name="line.1712"></a>
  1721. <span class="sourceLineNo">1713</span> /**<a name="line.1713"></a>
  1722. <span class="sourceLineNo">1714</span> * Sets the maximum label width as a percentage of the plot width and sends<a name="line.1714"></a>
  1723. <span class="sourceLineNo">1715</span> * a {@link PlotChangeEvent} to all registered listeners.<a name="line.1715"></a>
  1724. <span class="sourceLineNo">1716</span> *<a name="line.1716"></a>
  1725. <span class="sourceLineNo">1717</span> * @param width the width (a percentage, where 0.20 = 20 percent).<a name="line.1717"></a>
  1726. <span class="sourceLineNo">1718</span> *<a name="line.1718"></a>
  1727. <span class="sourceLineNo">1719</span> * @see #getMaximumLabelWidth()<a name="line.1719"></a>
  1728. <span class="sourceLineNo">1720</span> */<a name="line.1720"></a>
  1729. <span class="sourceLineNo">1721</span> public void setMaximumLabelWidth(double width) {<a name="line.1721"></a>
  1730. <span class="sourceLineNo">1722</span> this.maximumLabelWidth = width;<a name="line.1722"></a>
  1731. <span class="sourceLineNo">1723</span> fireChangeEvent();<a name="line.1723"></a>
  1732. <span class="sourceLineNo">1724</span> }<a name="line.1724"></a>
  1733. <span class="sourceLineNo">1725</span><a name="line.1725"></a>
  1734. <span class="sourceLineNo">1726</span> /**<a name="line.1726"></a>
  1735. <span class="sourceLineNo">1727</span> * Returns the flag that controls whether or not label linking lines are<a name="line.1727"></a>
  1736. <span class="sourceLineNo">1728</span> * visible.<a name="line.1728"></a>
  1737. <span class="sourceLineNo">1729</span> *<a name="line.1729"></a>
  1738. <span class="sourceLineNo">1730</span> * @return A boolean.<a name="line.1730"></a>
  1739. <span class="sourceLineNo">1731</span> *<a name="line.1731"></a>
  1740. <span class="sourceLineNo">1732</span> * @see #setLabelLinksVisible(boolean)<a name="line.1732"></a>
  1741. <span class="sourceLineNo">1733</span> */<a name="line.1733"></a>
  1742. <span class="sourceLineNo">1734</span> public boolean getLabelLinksVisible() {<a name="line.1734"></a>
  1743. <span class="sourceLineNo">1735</span> return this.labelLinksVisible;<a name="line.1735"></a>
  1744. <span class="sourceLineNo">1736</span> }<a name="line.1736"></a>
  1745. <span class="sourceLineNo">1737</span><a name="line.1737"></a>
  1746. <span class="sourceLineNo">1738</span> /**<a name="line.1738"></a>
  1747. <span class="sourceLineNo">1739</span> * Sets the flag that controls whether or not label linking lines are<a name="line.1739"></a>
  1748. <span class="sourceLineNo">1740</span> * visible and sends a {@link PlotChangeEvent} to all registered listeners.<a name="line.1740"></a>
  1749. <span class="sourceLineNo">1741</span> * Please take care when hiding the linking lines - depending on the data<a name="line.1741"></a>
  1750. <span class="sourceLineNo">1742</span> * values, the labels can be displayed some distance away from the<a name="line.1742"></a>
  1751. <span class="sourceLineNo">1743</span> * corresponding pie section.<a name="line.1743"></a>
  1752. <span class="sourceLineNo">1744</span> *<a name="line.1744"></a>
  1753. <span class="sourceLineNo">1745</span> * @param visible the flag.<a name="line.1745"></a>
  1754. <span class="sourceLineNo">1746</span> *<a name="line.1746"></a>
  1755. <span class="sourceLineNo">1747</span> * @see #getLabelLinksVisible()<a name="line.1747"></a>
  1756. <span class="sourceLineNo">1748</span> */<a name="line.1748"></a>
  1757. <span class="sourceLineNo">1749</span> public void setLabelLinksVisible(boolean visible) {<a name="line.1749"></a>
  1758. <span class="sourceLineNo">1750</span> this.labelLinksVisible = visible;<a name="line.1750"></a>
  1759. <span class="sourceLineNo">1751</span> fireChangeEvent();<a name="line.1751"></a>
  1760. <span class="sourceLineNo">1752</span> }<a name="line.1752"></a>
  1761. <span class="sourceLineNo">1753</span><a name="line.1753"></a>
  1762. <span class="sourceLineNo">1754</span> /**<a name="line.1754"></a>
  1763. <span class="sourceLineNo">1755</span> * Returns the label link style.<a name="line.1755"></a>
  1764. <span class="sourceLineNo">1756</span> *<a name="line.1756"></a>
  1765. <span class="sourceLineNo">1757</span> * @return The label link style (never &lt;code&gt;null&lt;/code&gt;).<a name="line.1757"></a>
  1766. <span class="sourceLineNo">1758</span> *<a name="line.1758"></a>
  1767. <span class="sourceLineNo">1759</span> * @see #setLabelLinkStyle(PieLabelLinkStyle)<a name="line.1759"></a>
  1768. <span class="sourceLineNo">1760</span> *<a name="line.1760"></a>
  1769. <span class="sourceLineNo">1761</span> * @since 1.0.10<a name="line.1761"></a>
  1770. <span class="sourceLineNo">1762</span> */<a name="line.1762"></a>
  1771. <span class="sourceLineNo">1763</span> public PieLabelLinkStyle getLabelLinkStyle() {<a name="line.1763"></a>
  1772. <span class="sourceLineNo">1764</span> return this.labelLinkStyle;<a name="line.1764"></a>
  1773. <span class="sourceLineNo">1765</span> }<a name="line.1765"></a>
  1774. <span class="sourceLineNo">1766</span><a name="line.1766"></a>
  1775. <span class="sourceLineNo">1767</span> /**<a name="line.1767"></a>
  1776. <span class="sourceLineNo">1768</span> * Sets the label link style and sends a {@link PlotChangeEvent} to all<a name="line.1768"></a>
  1777. <span class="sourceLineNo">1769</span> * registered listeners.<a name="line.1769"></a>
  1778. <span class="sourceLineNo">1770</span> *<a name="line.1770"></a>
  1779. <span class="sourceLineNo">1771</span> * @param style the new style (&lt;code&gt;null&lt;/code&gt; not permitted).<a name="line.1771"></a>
  1780. <span class="sourceLineNo">1772</span> *<a name="line.1772"></a>
  1781. <span class="sourceLineNo">1773</span> * @see #getLabelLinkStyle()<a name="line.1773"></a>
  1782. <span class="sourceLineNo">1774</span> *<a name="line.1774"></a>
  1783. <span class="sourceLineNo">1775</span> * @since 1.0.10<a name="line.1775"></a>
  1784. <span class="sourceLineNo">1776</span> */<a name="line.1776"></a>
  1785. <span class="sourceLineNo">1777</span> public void setLabelLinkStyle(PieLabelLinkStyle style) {<a name="line.1777"></a>
  1786. <span class="sourceLineNo">1778</span> ParamChecks.nullNotPermitted(style, "style");<a name="line.1778"></a>
  1787. <span class="sourceLineNo">1779</span> this.labelLinkStyle = style;<a name="line.1779"></a>
  1788. <span class="sourceLineNo">1780</span> fireChangeEvent();<a name="line.1780"></a>
  1789. <span class="sourceLineNo">1781</span> }<a name="line.1781"></a>
  1790. <span class="sourceLineNo">1782</span><a name="line.1782"></a>
  1791. <span class="sourceLineNo">1783</span> /**<a name="line.1783"></a>
  1792. <span class="sourceLineNo">1784</span> * Returns the margin (expressed as a percentage of the width or height)<a name="line.1784"></a>
  1793. <span class="sourceLineNo">1785</span> * between the edge of the pie and the link point.<a name="line.1785"></a>
  1794. <span class="sourceLineNo">1786</span> *<a name="line.1786"></a>
  1795. <span class="sourceLineNo">1787</span> * @return The link margin (as a percentage, where 0.05 is five percent).<a name="line.1787"></a>
  1796. <span class="sourceLineNo">1788</span> *<a name="line.1788"></a>
  1797. <span class="sourceLineNo">1789</span> * @see #setLabelLinkMargin(double)<a name="line.1789"></a>
  1798. <span class="sourceLineNo">1790</span> */<a name="line.1790"></a>
  1799. <span class="sourceLineNo">1791</span> public double getLabelLinkMargin() {<a name="line.1791"></a>
  1800. <span class="sourceLineNo">1792</span> return this.labelLinkMargin;<a name="line.1792"></a>
  1801. <span class="sourceLineNo">1793</span> }<a name="line.1793"></a>
  1802. <span class="sourceLineNo">1794</span><a name="line.1794"></a>
  1803. <span class="sourceLineNo">1795</span> /**<a name="line.1795"></a>
  1804. <span class="sourceLineNo">1796</span> * Sets the link margin and sends a {@link PlotChangeEvent} to all<a name="line.1796"></a>
  1805. <span class="sourceLineNo">1797</span> * registered listeners.<a name="line.1797"></a>
  1806. <span class="sourceLineNo">1798</span> *<a name="line.1798"></a>
  1807. <span class="sourceLineNo">1799</span> * @param margin the margin.<a name="line.1799"></a>
  1808. <span class="sourceLineNo">1800</span> *<a name="line.1800"></a>
  1809. <span class="sourceLineNo">1801</span> * @see #getLabelLinkMargin()<a name="line.1801"></a>
  1810. <span class="sourceLineNo">1802</span> */<a name="line.1802"></a>
  1811. <span class="sourceLineNo">1803</span> public void setLabelLinkMargin(double margin) {<a name="line.1803"></a>
  1812. <span class="sourceLineNo">1804</span> this.labelLinkMargin = margin;<a name="line.1804"></a>
  1813. <span class="sourceLineNo">1805</span> fireChangeEvent();<a name="line.1805"></a>
  1814. <span class="sourceLineNo">1806</span> }<a name="line.1806"></a>
  1815. <span class="sourceLineNo">1807</span><a name="line.1807"></a>
  1816. <span class="sourceLineNo">1808</span> /**<a name="line.1808"></a>
  1817. <span class="sourceLineNo">1809</span> * Returns the paint used for the lines that connect pie sections to their<a name="line.1809"></a>
  1818. <span class="sourceLineNo">1810</span> * corresponding labels.<a name="line.1810"></a>
  1819. <span class="sourceLineNo">1811</span> *<a name="line.1811"></a>
  1820. <span class="sourceLineNo">1812</span> * @return The paint (never &lt;code&gt;null&lt;/code&gt;).<a name="line.1812"></a>
  1821. <span class="sourceLineNo">1813</span> *<a name="line.1813"></a>
  1822. <span class="sourceLineNo">1814</span> * @see #setLabelLinkPaint(Paint)<a name="line.1814"></a>
  1823. <span class="sourceLineNo">1815</span> */<a name="line.1815"></a>
  1824. <span class="sourceLineNo">1816</span> public Paint getLabelLinkPaint() {<a name="line.1816"></a>
  1825. <span class="sourceLineNo">1817</span> return this.labelLinkPaint;<a name="line.1817"></a>
  1826. <span class="sourceLineNo">1818</span> }<a name="line.1818"></a>
  1827. <span class="sourceLineNo">1819</span><a name="line.1819"></a>
  1828. <span class="sourceLineNo">1820</span> /**<a name="line.1820"></a>
  1829. <span class="sourceLineNo">1821</span> * Sets the paint used for the lines that connect pie sections to their<a name="line.1821"></a>
  1830. <span class="sourceLineNo">1822</span> * corresponding labels, and sends a {@link PlotChangeEvent} to all<a name="line.1822"></a>
  1831. <span class="sourceLineNo">1823</span> * registered listeners.<a name="line.1823"></a>
  1832. <span class="sourceLineNo">1824</span> *<a name="line.1824"></a>
  1833. <span class="sourceLineNo">1825</span> * @param paint the paint (&lt;code&gt;null&lt;/code&gt; not permitted).<a name="line.1825"></a>
  1834. <span class="sourceLineNo">1826</span> *<a name="line.1826"></a>
  1835. <span class="sourceLineNo">1827</span> * @see #getLabelLinkPaint()<a name="line.1827"></a>
  1836. <span class="sourceLineNo">1828</span> */<a name="line.1828"></a>
  1837. <span class="sourceLineNo">1829</span> public void setLabelLinkPaint(Paint paint) {<a name="line.1829"></a>
  1838. <span class="sourceLineNo">1830</span> ParamChecks.nullNotPermitted(paint, "paint");<a name="line.1830"></a>
  1839. <span class="sourceLineNo">1831</span> this.labelLinkPaint = paint;<a name="line.1831"></a>
  1840. <span class="sourceLineNo">1832</span> fireChangeEvent();<a name="line.1832"></a>
  1841. <span class="sourceLineNo">1833</span> }<a name="line.1833"></a>
  1842. <span class="sourceLineNo">1834</span><a name="line.1834"></a>
  1843. <span class="sourceLineNo">1835</span> /**<a name="line.1835"></a>
  1844. <span class="sourceLineNo">1836</span> * Returns the stroke used for the label linking lines.<a name="line.1836"></a>
  1845. <span class="sourceLineNo">1837</span> *<a name="line.1837"></a>
  1846. <span class="sourceLineNo">1838</span> * @return The stroke.<a name="line.1838"></a>
  1847. <span class="sourceLineNo">1839</span> *<a name="line.1839"></a>
  1848. <span class="sourceLineNo">1840</span> * @see #setLabelLinkStroke(Stroke)<a name="line.1840"></a>
  1849. <span class="sourceLineNo">1841</span> */<a name="line.1841"></a>
  1850. <span class="sourceLineNo">1842</span> public Stroke getLabelLinkStroke() {<a name="line.1842"></a>
  1851. <span class="sourceLineNo">1843</span> return this.labelLinkStroke;<a name="line.1843"></a>
  1852. <span class="sourceLineNo">1844</span> }<a name="line.1844"></a>
  1853. <span class="sourceLineNo">1845</span><a name="line.1845"></a>
  1854. <span class="sourceLineNo">1846</span> /**<a name="line.1846"></a>
  1855. <span class="sourceLineNo">1847</span> * Sets the link stroke and sends a {@link PlotChangeEvent} to all<a name="line.1847"></a>
  1856. <span class="sourceLineNo">1848</span> * registered listeners.<a name="line.1848"></a>
  1857. <span class="sourceLineNo">1849</span> *<a name="line.1849"></a>
  1858. <span class="sourceLineNo">1850</span> * @param stroke the stroke.<a name="line.1850"></a>
  1859. <span class="sourceLineNo">1851</span> *<a name="line.1851"></a>
  1860. <span class="sourceLineNo">1852</span> * @see #getLabelLinkStroke()<a name="line.1852"></a>
  1861. <span class="sourceLineNo">1853</span> */<a name="line.1853"></a>
  1862. <span class="sourceLineNo">1854</span> public void setLabelLinkStroke(Stroke stroke) {<a name="line.1854"></a>
  1863. <span class="sourceLineNo">1855</span> ParamChecks.nullNotPermitted(stroke, "stroke");<a name="line.1855"></a>
  1864. <span class="sourceLineNo">1856</span> this.labelLinkStroke = stroke;<a name="line.1856"></a>
  1865. <span class="sourceLineNo">1857</span> fireChangeEvent();<a name="line.1857"></a>
  1866. <span class="sourceLineNo">1858</span> }<a name="line.1858"></a>
  1867. <span class="sourceLineNo">1859</span><a name="line.1859"></a>
  1868. <span class="sourceLineNo">1860</span> /**<a name="line.1860"></a>
  1869. <span class="sourceLineNo">1861</span> * Returns the distance that the end of the label link is embedded into<a name="line.1861"></a>
  1870. <span class="sourceLineNo">1862</span> * the plot, expressed as a percentage of the plot's radius.<a name="line.1862"></a>
  1871. <span class="sourceLineNo">1863</span> * &lt;br&gt;&lt;br&gt;<a name="line.1863"></a>
  1872. <span class="sourceLineNo">1864</span> * This method is overridden in the {@link RingPlot} class to resolve<a name="line.1864"></a>
  1873. <span class="sourceLineNo">1865</span> * bug 2121818.<a name="line.1865"></a>
  1874. <span class="sourceLineNo">1866</span> *<a name="line.1866"></a>
  1875. <span class="sourceLineNo">1867</span> * @return &lt;code&gt;0.10&lt;/code&gt;.<a name="line.1867"></a>
  1876. <span class="sourceLineNo">1868</span> *<a name="line.1868"></a>
  1877. <span class="sourceLineNo">1869</span> * @since 1.0.12<a name="line.1869"></a>
  1878. <span class="sourceLineNo">1870</span> */<a name="line.1870"></a>
  1879. <span class="sourceLineNo">1871</span> protected double getLabelLinkDepth() {<a name="line.1871"></a>
  1880. <span class="sourceLineNo">1872</span> return 0.1;<a name="line.1872"></a>
  1881. <span class="sourceLineNo">1873</span> }<a name="line.1873"></a>
  1882. <span class="sourceLineNo">1874</span><a name="line.1874"></a>
  1883. <span class="sourceLineNo">1875</span> /**<a name="line.1875"></a>
  1884. <span class="sourceLineNo">1876</span> * Returns the section label font.<a name="line.1876"></a>
  1885. <span class="sourceLineNo">1877</span> *<a name="line.1877"></a>
  1886. <span class="sourceLineNo">1878</span> * @return The font (never &lt;code&gt;null&lt;/code&gt;).<a name="line.1878"></a>
  1887. <span class="sourceLineNo">1879</span> *<a name="line.1879"></a>
  1888. <span class="sourceLineNo">1880</span> * @see #setLabelFont(Font)<a name="line.1880"></a>
  1889. <span class="sourceLineNo">1881</span> */<a name="line.1881"></a>
  1890. <span class="sourceLineNo">1882</span> public Font getLabelFont() {<a name="line.1882"></a>
  1891. <span class="sourceLineNo">1883</span> return this.labelFont;<a name="line.1883"></a>
  1892. <span class="sourceLineNo">1884</span> }<a name="line.1884"></a>
  1893. <span class="sourceLineNo">1885</span><a name="line.1885"></a>
  1894. <span class="sourceLineNo">1886</span> /**<a name="line.1886"></a>
  1895. <span class="sourceLineNo">1887</span> * Sets the section label font and sends a {@link PlotChangeEvent} to all<a name="line.1887"></a>
  1896. <span class="sourceLineNo">1888</span> * registered listeners.<a name="line.1888"></a>
  1897. <span class="sourceLineNo">1889</span> *<a name="line.1889"></a>
  1898. <span class="sourceLineNo">1890</span> * @param font the font (&lt;code&gt;null&lt;/code&gt; not permitted).<a name="line.1890"></a>
  1899. <span class="sourceLineNo">1891</span> *<a name="line.1891"></a>
  1900. <span class="sourceLineNo">1892</span> * @see #getLabelFont()<a name="line.1892"></a>
  1901. <span class="sourceLineNo">1893</span> */<a name="line.1893"></a>
  1902. <span class="sourceLineNo">1894</span> public void setLabelFont(Font font) {<a name="line.1894"></a>
  1903. <span class="sourceLineNo">1895</span> ParamChecks.nullNotPermitted(font, "font");<a name="line.1895"></a>
  1904. <span class="sourceLineNo">1896</span> this.labelFont = font;<a name="line.1896"></a>
  1905. <span class="sourceLineNo">1897</span> fireChangeEvent();<a name="line.1897"></a>
  1906. <span class="sourceLineNo">1898</span> }<a name="line.1898"></a>
  1907. <span class="sourceLineNo">1899</span><a name="line.1899"></a>
  1908. <span class="sourceLineNo">1900</span> /**<a name="line.1900"></a>
  1909. <span class="sourceLineNo">1901</span> * Returns the section label paint.<a name="line.1901"></a>
  1910. <span class="sourceLineNo">1902</span> *<a name="line.1902"></a>
  1911. <span class="sourceLineNo">1903</span> * @return The paint (never &lt;code&gt;null&lt;/code&gt;).<a name="line.1903"></a>
  1912. <span class="sourceLineNo">1904</span> *<a name="line.1904"></a>
  1913. <span class="sourceLineNo">1905</span> * @see #setLabelPaint(Paint)<a name="line.1905"></a>
  1914. <span class="sourceLineNo">1906</span> */<a name="line.1906"></a>
  1915. <span class="sourceLineNo">1907</span> public Paint getLabelPaint() {<a name="line.1907"></a>
  1916. <span class="sourceLineNo">1908</span> return this.labelPaint;<a name="line.1908"></a>
  1917. <span class="sourceLineNo">1909</span> }<a name="line.1909"></a>
  1918. <span class="sourceLineNo">1910</span><a name="line.1910"></a>
  1919. <span class="sourceLineNo">1911</span> /**<a name="line.1911"></a>
  1920. <span class="sourceLineNo">1912</span> * Sets the section label paint and sends a {@link PlotChangeEvent} to all<a name="line.1912"></a>
  1921. <span class="sourceLineNo">1913</span> * registered listeners.<a name="line.1913"></a>
  1922. <span class="sourceLineNo">1914</span> *<a name="line.1914"></a>
  1923. <span class="sourceLineNo">1915</span> * @param paint the paint (&lt;code&gt;null&lt;/code&gt; not permitted).<a name="line.1915"></a>
  1924. <span class="sourceLineNo">1916</span> *<a name="line.1916"></a>
  1925. <span class="sourceLineNo">1917</span> * @see #getLabelPaint()<a name="line.1917"></a>
  1926. <span class="sourceLineNo">1918</span> */<a name="line.1918"></a>
  1927. <span class="sourceLineNo">1919</span> public void setLabelPaint(Paint paint) {<a name="line.1919"></a>
  1928. <span class="sourceLineNo">1920</span> ParamChecks.nullNotPermitted(paint, "paint");<a name="line.1920"></a>
  1929. <span class="sourceLineNo">1921</span> this.labelPaint = paint;<a name="line.1921"></a>
  1930. <span class="sourceLineNo">1922</span> fireChangeEvent();<a name="line.1922"></a>
  1931. <span class="sourceLineNo">1923</span> }<a name="line.1923"></a>
  1932. <span class="sourceLineNo">1924</span><a name="line.1924"></a>
  1933. <span class="sourceLineNo">1925</span> /**<a name="line.1925"></a>
  1934. <span class="sourceLineNo">1926</span> * Returns the section label background paint.<a name="line.1926"></a>
  1935. <span class="sourceLineNo">1927</span> *<a name="line.1927"></a>
  1936. <span class="sourceLineNo">1928</span> * @return The paint (possibly &lt;code&gt;null&lt;/code&gt;).<a name="line.1928"></a>
  1937. <span class="sourceLineNo">1929</span> *<a name="line.1929"></a>
  1938. <span class="sourceLineNo">1930</span> * @see #setLabelBackgroundPaint(Paint)<a name="line.1930"></a>
  1939. <span class="sourceLineNo">1931</span> */<a name="line.1931"></a>
  1940. <span class="sourceLineNo">1932</span> public Paint getLabelBackgroundPaint() {<a name="line.1932"></a>
  1941. <span class="sourceLineNo">1933</span> return this.labelBackgroundPaint;<a name="line.1933"></a>
  1942. <span class="sourceLineNo">1934</span> }<a name="line.1934"></a>
  1943. <span class="sourceLineNo">1935</span><a name="line.1935"></a>
  1944. <span class="sourceLineNo">1936</span> /**<a name="line.1936"></a>
  1945. <span class="sourceLineNo">1937</span> * Sets the section label background paint and sends a<a name="line.1937"></a>
  1946. <span class="sourceLineNo">1938</span> * {@link PlotChangeEvent} to all registered listeners.<a name="line.1938"></a>
  1947. <span class="sourceLineNo">1939</span> *<a name="line.1939"></a>
  1948. <span class="sourceLineNo">1940</span> * @param paint the paint (&lt;code&gt;null&lt;/code&gt; permitted).<a name="line.1940"></a>
  1949. <span class="sourceLineNo">1941</span> *<a name="line.1941"></a>
  1950. <span class="sourceLineNo">1942</span> * @see #getLabelBackgroundPaint()<a name="line.1942"></a>
  1951. <span class="sourceLineNo">1943</span> */<a name="line.1943"></a>
  1952. <span class="sourceLineNo">1944</span> public void setLabelBackgroundPaint(Paint paint) {<a name="line.1944"></a>
  1953. <span class="sourceLineNo">1945</span> this.labelBackgroundPaint = paint;<a name="line.1945"></a>
  1954. <span class="sourceLineNo">1946</span> fireChangeEvent();<a name="line.1946"></a>
  1955. <span class="sourceLineNo">1947</span> }<a name="line.1947"></a>
  1956. <span class="sourceLineNo">1948</span><a name="line.1948"></a>
  1957. <span class="sourceLineNo">1949</span> /**<a name="line.1949"></a>
  1958. <span class="sourceLineNo">1950</span> * Returns the section label outline paint.<a name="line.1950"></a>
  1959. <span class="sourceLineNo">1951</span> *<a name="line.1951"></a>
  1960. <span class="sourceLineNo">1952</span> * @return The paint (possibly &lt;code&gt;null&lt;/code&gt;).<a name="line.1952"></a>
  1961. <span class="sourceLineNo">1953</span> *<a name="line.1953"></a>
  1962. <span class="sourceLineNo">1954</span> * @see #setLabelOutlinePaint(Paint)<a name="line.1954"></a>
  1963. <span class="sourceLineNo">1955</span> */<a name="line.1955"></a>
  1964. <span class="sourceLineNo">1956</span> public Paint getLabelOutlinePaint() {<a name="line.1956"></a>
  1965. <span class="sourceLineNo">1957</span> return this.labelOutlinePaint;<a name="line.1957"></a>
  1966. <span class="sourceLineNo">1958</span> }<a name="line.1958"></a>
  1967. <span class="sourceLineNo">1959</span><a name="line.1959"></a>
  1968. <span class="sourceLineNo">1960</span> /**<a name="line.1960"></a>
  1969. <span class="sourceLineNo">1961</span> * Sets the section label outline paint and sends a<a name="line.1961"></a>
  1970. <span class="sourceLineNo">1962</span> * {@link PlotChangeEvent} to all registered listeners.<a name="line.1962"></a>
  1971. <span class="sourceLineNo">1963</span> *<a name="line.1963"></a>
  1972. <span class="sourceLineNo">1964</span> * @param paint the paint (&lt;code&gt;null&lt;/code&gt; permitted).<a name="line.1964"></a>
  1973. <span class="sourceLineNo">1965</span> *<a name="line.1965"></a>
  1974. <span class="sourceLineNo">1966</span> * @see #getLabelOutlinePaint()<a name="line.1966"></a>
  1975. <span class="sourceLineNo">1967</span> */<a name="line.1967"></a>
  1976. <span class="sourceLineNo">1968</span> public void setLabelOutlinePaint(Paint paint) {<a name="line.1968"></a>
  1977. <span class="sourceLineNo">1969</span> this.labelOutlinePaint = paint;<a name="line.1969"></a>
  1978. <span class="sourceLineNo">1970</span> fireChangeEvent();<a name="line.1970"></a>
  1979. <span class="sourceLineNo">1971</span> }<a name="line.1971"></a>
  1980. <span class="sourceLineNo">1972</span><a name="line.1972"></a>
  1981. <span class="sourceLineNo">1973</span> /**<a name="line.1973"></a>
  1982. <span class="sourceLineNo">1974</span> * Returns the section label outline stroke.<a name="line.1974"></a>
  1983. <span class="sourceLineNo">1975</span> *<a name="line.1975"></a>
  1984. <span class="sourceLineNo">1976</span> * @return The stroke (possibly &lt;code&gt;null&lt;/code&gt;).<a name="line.1976"></a>
  1985. <span class="sourceLineNo">1977</span> *<a name="line.1977"></a>
  1986. <span class="sourceLineNo">1978</span> * @see #setLabelOutlineStroke(Stroke)<a name="line.1978"></a>
  1987. <span class="sourceLineNo">1979</span> */<a name="line.1979"></a>
  1988. <span class="sourceLineNo">1980</span> public Stroke getLabelOutlineStroke() {<a name="line.1980"></a>
  1989. <span class="sourceLineNo">1981</span> return this.labelOutlineStroke;<a name="line.1981"></a>
  1990. <span class="sourceLineNo">1982</span> }<a name="line.1982"></a>
  1991. <span class="sourceLineNo">1983</span><a name="line.1983"></a>
  1992. <span class="sourceLineNo">1984</span> /**<a name="line.1984"></a>
  1993. <span class="sourceLineNo">1985</span> * Sets the section label outline stroke and sends a<a name="line.1985"></a>
  1994. <span class="sourceLineNo">1986</span> * {@link PlotChangeEvent} to all registered listeners.<a name="line.1986"></a>
  1995. <span class="sourceLineNo">1987</span> *<a name="line.1987"></a>
  1996. <span class="sourceLineNo">1988</span> * @param stroke the stroke (&lt;code&gt;null&lt;/code&gt; permitted).<a name="line.1988"></a>
  1997. <span class="sourceLineNo">1989</span> *<a name="line.1989"></a>
  1998. <span class="sourceLineNo">1990</span> * @see #getLabelOutlineStroke()<a name="line.1990"></a>
  1999. <span class="sourceLineNo">1991</span> */<a name="line.1991"></a>
  2000. <span class="sourceLineNo">1992</span> public void setLabelOutlineStroke(Stroke stroke) {<a name="line.1992"></a>
  2001. <span class="sourceLineNo">1993</span> this.labelOutlineStroke = stroke;<a name="line.1993"></a>
  2002. <span class="sourceLineNo">1994</span> fireChangeEvent();<a name="line.1994"></a>
  2003. <span class="sourceLineNo">1995</span> }<a name="line.1995"></a>
  2004. <span class="sourceLineNo">1996</span><a name="line.1996"></a>
  2005. <span class="sourceLineNo">1997</span> /**<a name="line.1997"></a>
  2006. <span class="sourceLineNo">1998</span> * Returns the section label shadow paint.<a name="line.1998"></a>
  2007. <span class="sourceLineNo">1999</span> *<a name="line.1999"></a>
  2008. <span class="sourceLineNo">2000</span> * @return The paint (possibly &lt;code&gt;null&lt;/code&gt;).<a name="line.2000"></a>
  2009. <span class="sourceLineNo">2001</span> *<a name="line.2001"></a>
  2010. <span class="sourceLineNo">2002</span> * @see #setLabelShadowPaint(Paint)<a name="line.2002"></a>
  2011. <span class="sourceLineNo">2003</span> */<a name="line.2003"></a>
  2012. <span class="sourceLineNo">2004</span> public Paint getLabelShadowPaint() {<a name="line.2004"></a>
  2013. <span class="sourceLineNo">2005</span> return this.labelShadowPaint;<a name="line.2005"></a>
  2014. <span class="sourceLineNo">2006</span> }<a name="line.2006"></a>
  2015. <span class="sourceLineNo">2007</span><a name="line.2007"></a>
  2016. <span class="sourceLineNo">2008</span> /**<a name="line.2008"></a>
  2017. <span class="sourceLineNo">2009</span> * Sets the section label shadow paint and sends a {@link PlotChangeEvent}<a name="line.2009"></a>
  2018. <span class="sourceLineNo">2010</span> * to all registered listeners.<a name="line.2010"></a>
  2019. <span class="sourceLineNo">2011</span> *<a name="line.2011"></a>
  2020. <span class="sourceLineNo">2012</span> * @param paint the paint (&lt;code&gt;null&lt;/code&gt; permitted).<a name="line.2012"></a>
  2021. <span class="sourceLineNo">2013</span> *<a name="line.2013"></a>
  2022. <span class="sourceLineNo">2014</span> * @see #getLabelShadowPaint()<a name="line.2014"></a>
  2023. <span class="sourceLineNo">2015</span> */<a name="line.2015"></a>
  2024. <span class="sourceLineNo">2016</span> public void setLabelShadowPaint(Paint paint) {<a name="line.2016"></a>
  2025. <span class="sourceLineNo">2017</span> this.labelShadowPaint = paint;<a name="line.2017"></a>
  2026. <span class="sourceLineNo">2018</span> fireChangeEvent();<a name="line.2018"></a>
  2027. <span class="sourceLineNo">2019</span> }<a name="line.2019"></a>
  2028. <span class="sourceLineNo">2020</span><a name="line.2020"></a>
  2029. <span class="sourceLineNo">2021</span> /**<a name="line.2021"></a>
  2030. <span class="sourceLineNo">2022</span> * Returns the label padding.<a name="line.2022"></a>
  2031. <span class="sourceLineNo">2023</span> *<a name="line.2023"></a>
  2032. <span class="sourceLineNo">2024</span> * @return The label padding (never &lt;code&gt;null&lt;/code&gt;).<a name="line.2024"></a>
  2033. <span class="sourceLineNo">2025</span> *<a name="line.2025"></a>
  2034. <span class="sourceLineNo">2026</span> * @since 1.0.7<a name="line.2026"></a>
  2035. <span class="sourceLineNo">2027</span> *<a name="line.2027"></a>
  2036. <span class="sourceLineNo">2028</span> * @see #setLabelPadding(RectangleInsets)<a name="line.2028"></a>
  2037. <span class="sourceLineNo">2029</span> */<a name="line.2029"></a>
  2038. <span class="sourceLineNo">2030</span> public RectangleInsets getLabelPadding() {<a name="line.2030"></a>
  2039. <span class="sourceLineNo">2031</span> return this.labelPadding;<a name="line.2031"></a>
  2040. <span class="sourceLineNo">2032</span> }<a name="line.2032"></a>
  2041. <span class="sourceLineNo">2033</span><a name="line.2033"></a>
  2042. <span class="sourceLineNo">2034</span> /**<a name="line.2034"></a>
  2043. <span class="sourceLineNo">2035</span> * Sets the padding between each label and its outline and sends a<a name="line.2035"></a>
  2044. <span class="sourceLineNo">2036</span> * {@link PlotChangeEvent} to all registered listeners.<a name="line.2036"></a>
  2045. <span class="sourceLineNo">2037</span> *<a name="line.2037"></a>
  2046. <span class="sourceLineNo">2038</span> * @param padding the padding (&lt;code&gt;null&lt;/code&gt; not permitted).<a name="line.2038"></a>
  2047. <span class="sourceLineNo">2039</span> *<a name="line.2039"></a>
  2048. <span class="sourceLineNo">2040</span> * @since 1.0.7<a name="line.2040"></a>
  2049. <span class="sourceLineNo">2041</span> *<a name="line.2041"></a>
  2050. <span class="sourceLineNo">2042</span> * @see #getLabelPadding()<a name="line.2042"></a>
  2051. <span class="sourceLineNo">2043</span> */<a name="line.2043"></a>
  2052. <span class="sourceLineNo">2044</span> public void setLabelPadding(RectangleInsets padding) {<a name="line.2044"></a>
  2053. <span class="sourceLineNo">2045</span> ParamChecks.nullNotPermitted(padding, "padding");<a name="line.2045"></a>
  2054. <span class="sourceLineNo">2046</span> this.labelPadding = padding;<a name="line.2046"></a>
  2055. <span class="sourceLineNo">2047</span> fireChangeEvent();<a name="line.2047"></a>
  2056. <span class="sourceLineNo">2048</span> }<a name="line.2048"></a>
  2057. <span class="sourceLineNo">2049</span><a name="line.2049"></a>
  2058. <span class="sourceLineNo">2050</span> /**<a name="line.2050"></a>
  2059. <span class="sourceLineNo">2051</span> * Returns the flag that controls whether simple or extended labels are<a name="line.2051"></a>
  2060. <span class="sourceLineNo">2052</span> * displayed on the plot.<a name="line.2052"></a>
  2061. <span class="sourceLineNo">2053</span> *<a name="line.2053"></a>
  2062. <span class="sourceLineNo">2054</span> * @return A boolean.<a name="line.2054"></a>
  2063. <span class="sourceLineNo">2055</span> *<a name="line.2055"></a>
  2064. <span class="sourceLineNo">2056</span> * @since 1.0.7<a name="line.2056"></a>
  2065. <span class="sourceLineNo">2057</span> */<a name="line.2057"></a>
  2066. <span class="sourceLineNo">2058</span> public boolean getSimpleLabels() {<a name="line.2058"></a>
  2067. <span class="sourceLineNo">2059</span> return this.simpleLabels;<a name="line.2059"></a>
  2068. <span class="sourceLineNo">2060</span> }<a name="line.2060"></a>
  2069. <span class="sourceLineNo">2061</span><a name="line.2061"></a>
  2070. <span class="sourceLineNo">2062</span> /**<a name="line.2062"></a>
  2071. <span class="sourceLineNo">2063</span> * Sets the flag that controls whether simple or extended labels are<a name="line.2063"></a>
  2072. <span class="sourceLineNo">2064</span> * displayed on the plot, and sends a {@link PlotChangeEvent} to all<a name="line.2064"></a>
  2073. <span class="sourceLineNo">2065</span> * registered listeners.<a name="line.2065"></a>
  2074. <span class="sourceLineNo">2066</span> *<a name="line.2066"></a>
  2075. <span class="sourceLineNo">2067</span> * @param simple the new flag value.<a name="line.2067"></a>
  2076. <span class="sourceLineNo">2068</span> *<a name="line.2068"></a>
  2077. <span class="sourceLineNo">2069</span> * @since 1.0.7<a name="line.2069"></a>
  2078. <span class="sourceLineNo">2070</span> */<a name="line.2070"></a>
  2079. <span class="sourceLineNo">2071</span> public void setSimpleLabels(boolean simple) {<a name="line.2071"></a>
  2080. <span class="sourceLineNo">2072</span> this.simpleLabels = simple;<a name="line.2072"></a>
  2081. <span class="sourceLineNo">2073</span> fireChangeEvent();<a name="line.2073"></a>
  2082. <span class="sourceLineNo">2074</span> }<a name="line.2074"></a>
  2083. <span class="sourceLineNo">2075</span><a name="line.2075"></a>
  2084. <span class="sourceLineNo">2076</span> /**<a name="line.2076"></a>
  2085. <span class="sourceLineNo">2077</span> * Returns the offset used for the simple labels, if they are displayed.<a name="line.2077"></a>
  2086. <span class="sourceLineNo">2078</span> *<a name="line.2078"></a>
  2087. <span class="sourceLineNo">2079</span> * @return The offset (never &lt;code&gt;null&lt;/code&gt;).<a name="line.2079"></a>
  2088. <span class="sourceLineNo">2080</span> *<a name="line.2080"></a>
  2089. <span class="sourceLineNo">2081</span> * @since 1.0.7<a name="line.2081"></a>
  2090. <span class="sourceLineNo">2082</span> *<a name="line.2082"></a>
  2091. <span class="sourceLineNo">2083</span> * @see #setSimpleLabelOffset(RectangleInsets)<a name="line.2083"></a>
  2092. <span class="sourceLineNo">2084</span> */<a name="line.2084"></a>
  2093. <span class="sourceLineNo">2085</span> public RectangleInsets getSimpleLabelOffset() {<a name="line.2085"></a>
  2094. <span class="sourceLineNo">2086</span> return this.simpleLabelOffset;<a name="line.2086"></a>
  2095. <span class="sourceLineNo">2087</span> }<a name="line.2087"></a>
  2096. <span class="sourceLineNo">2088</span><a name="line.2088"></a>
  2097. <span class="sourceLineNo">2089</span> /**<a name="line.2089"></a>
  2098. <span class="sourceLineNo">2090</span> * Sets the offset for the simple labels and sends a<a name="line.2090"></a>
  2099. <span class="sourceLineNo">2091</span> * {@link PlotChangeEvent} to all registered listeners.<a name="line.2091"></a>
  2100. <span class="sourceLineNo">2092</span> *<a name="line.2092"></a>
  2101. <span class="sourceLineNo">2093</span> * @param offset the offset (&lt;code&gt;null&lt;/code&gt; not permitted).<a name="line.2093"></a>
  2102. <span class="sourceLineNo">2094</span> *<a name="line.2094"></a>
  2103. <span class="sourceLineNo">2095</span> * @since 1.0.7<a name="line.2095"></a>
  2104. <span class="sourceLineNo">2096</span> *<a name="line.2096"></a>
  2105. <span class="sourceLineNo">2097</span> * @see #getSimpleLabelOffset()<a name="line.2097"></a>
  2106. <span class="sourceLineNo">2098</span> */<a name="line.2098"></a>
  2107. <span class="sourceLineNo">2099</span> public void setSimpleLabelOffset(RectangleInsets offset) {<a name="line.2099"></a>
  2108. <span class="sourceLineNo">2100</span> ParamChecks.nullNotPermitted(offset, "offset");<a name="line.2100"></a>
  2109. <span class="sourceLineNo">2101</span> this.simpleLabelOffset = offset;<a name="line.2101"></a>
  2110. <span class="sourceLineNo">2102</span> fireChangeEvent();<a name="line.2102"></a>
  2111. <span class="sourceLineNo">2103</span> }<a name="line.2103"></a>
  2112. <span class="sourceLineNo">2104</span><a name="line.2104"></a>
  2113. <span class="sourceLineNo">2105</span> /**<a name="line.2105"></a>
  2114. <span class="sourceLineNo">2106</span> * Returns the object responsible for the vertical layout of the pie<a name="line.2106"></a>
  2115. <span class="sourceLineNo">2107</span> * section labels.<a name="line.2107"></a>
  2116. <span class="sourceLineNo">2108</span> *<a name="line.2108"></a>
  2117. <span class="sourceLineNo">2109</span> * @return The label distributor (never &lt;code&gt;null&lt;/code&gt;).<a name="line.2109"></a>
  2118. <span class="sourceLineNo">2110</span> *<a name="line.2110"></a>
  2119. <span class="sourceLineNo">2111</span> * @since 1.0.6<a name="line.2111"></a>
  2120. <span class="sourceLineNo">2112</span> */<a name="line.2112"></a>
  2121. <span class="sourceLineNo">2113</span> public AbstractPieLabelDistributor getLabelDistributor() {<a name="line.2113"></a>
  2122. <span class="sourceLineNo">2114</span> return this.labelDistributor;<a name="line.2114"></a>
  2123. <span class="sourceLineNo">2115</span> }<a name="line.2115"></a>
  2124. <span class="sourceLineNo">2116</span><a name="line.2116"></a>
  2125. <span class="sourceLineNo">2117</span> /**<a name="line.2117"></a>
  2126. <span class="sourceLineNo">2118</span> * Sets the label distributor and sends a {@link PlotChangeEvent} to all<a name="line.2118"></a>
  2127. <span class="sourceLineNo">2119</span> * registered listeners.<a name="line.2119"></a>
  2128. <span class="sourceLineNo">2120</span> *<a name="line.2120"></a>
  2129. <span class="sourceLineNo">2121</span> * @param distributor the distributor (&lt;code&gt;null&lt;/code&gt; not permitted).<a name="line.2121"></a>
  2130. <span class="sourceLineNo">2122</span> *<a name="line.2122"></a>
  2131. <span class="sourceLineNo">2123</span> * @since 1.0.6<a name="line.2123"></a>
  2132. <span class="sourceLineNo">2124</span> */<a name="line.2124"></a>
  2133. <span class="sourceLineNo">2125</span> public void setLabelDistributor(AbstractPieLabelDistributor distributor) {<a name="line.2125"></a>
  2134. <span class="sourceLineNo">2126</span> ParamChecks.nullNotPermitted(distributor, "distributor");<a name="line.2126"></a>
  2135. <span class="sourceLineNo">2127</span> this.labelDistributor = distributor;<a name="line.2127"></a>
  2136. <span class="sourceLineNo">2128</span> fireChangeEvent();<a name="line.2128"></a>
  2137. <span class="sourceLineNo">2129</span> }<a name="line.2129"></a>
  2138. <span class="sourceLineNo">2130</span><a name="line.2130"></a>
  2139. <span class="sourceLineNo">2131</span> /**<a name="line.2131"></a>
  2140. <span class="sourceLineNo">2132</span> * Returns the tool tip generator, an object that is responsible for<a name="line.2132"></a>
  2141. <span class="sourceLineNo">2133</span> * generating the text items used for tool tips by the plot. If the<a name="line.2133"></a>
  2142. <span class="sourceLineNo">2134</span> * generator is &lt;code&gt;null&lt;/code&gt;, no tool tips will be created.<a name="line.2134"></a>
  2143. <span class="sourceLineNo">2135</span> *<a name="line.2135"></a>
  2144. <span class="sourceLineNo">2136</span> * @return The generator (possibly &lt;code&gt;null&lt;/code&gt;).<a name="line.2136"></a>
  2145. <span class="sourceLineNo">2137</span> *<a name="line.2137"></a>
  2146. <span class="sourceLineNo">2138</span> * @see #setToolTipGenerator(PieToolTipGenerator)<a name="line.2138"></a>
  2147. <span class="sourceLineNo">2139</span> */<a name="line.2139"></a>
  2148. <span class="sourceLineNo">2140</span> public PieToolTipGenerator getToolTipGenerator() {<a name="line.2140"></a>
  2149. <span class="sourceLineNo">2141</span> return this.toolTipGenerator;<a name="line.2141"></a>
  2150. <span class="sourceLineNo">2142</span> }<a name="line.2142"></a>
  2151. <span class="sourceLineNo">2143</span><a name="line.2143"></a>
  2152. <span class="sourceLineNo">2144</span> /**<a name="line.2144"></a>
  2153. <span class="sourceLineNo">2145</span> * Sets the tool tip generator and sends a {@link PlotChangeEvent} to all<a name="line.2145"></a>
  2154. <span class="sourceLineNo">2146</span> * registered listeners. Set the generator to &lt;code&gt;null&lt;/code&gt; if you<a name="line.2146"></a>
  2155. <span class="sourceLineNo">2147</span> * don't want any tool tips.<a name="line.2147"></a>
  2156. <span class="sourceLineNo">2148</span> *<a name="line.2148"></a>
  2157. <span class="sourceLineNo">2149</span> * @param generator the generator (&lt;code&gt;null&lt;/code&gt; permitted).<a name="line.2149"></a>
  2158. <span class="sourceLineNo">2150</span> *<a name="line.2150"></a>
  2159. <span class="sourceLineNo">2151</span> * @see #getToolTipGenerator()<a name="line.2151"></a>
  2160. <span class="sourceLineNo">2152</span> */<a name="line.2152"></a>
  2161. <span class="sourceLineNo">2153</span> public void setToolTipGenerator(PieToolTipGenerator generator) {<a name="line.2153"></a>
  2162. <span class="sourceLineNo">2154</span> this.toolTipGenerator = generator;<a name="line.2154"></a>
  2163. <span class="sourceLineNo">2155</span> fireChangeEvent();<a name="line.2155"></a>
  2164. <span class="sourceLineNo">2156</span> }<a name="line.2156"></a>
  2165. <span class="sourceLineNo">2157</span><a name="line.2157"></a>
  2166. <span class="sourceLineNo">2158</span> /**<a name="line.2158"></a>
  2167. <span class="sourceLineNo">2159</span> * Returns the URL generator.<a name="line.2159"></a>
  2168. <span class="sourceLineNo">2160</span> *<a name="line.2160"></a>
  2169. <span class="sourceLineNo">2161</span> * @return The generator (possibly &lt;code&gt;null&lt;/code&gt;).<a name="line.2161"></a>
  2170. <span class="sourceLineNo">2162</span> *<a name="line.2162"></a>
  2171. <span class="sourceLineNo">2163</span> * @see #setURLGenerator(PieURLGenerator)<a name="line.2163"></a>
  2172. <span class="sourceLineNo">2164</span> */<a name="line.2164"></a>
  2173. <span class="sourceLineNo">2165</span> public PieURLGenerator getURLGenerator() {<a name="line.2165"></a>
  2174. <span class="sourceLineNo">2166</span> return this.urlGenerator;<a name="line.2166"></a>
  2175. <span class="sourceLineNo">2167</span> }<a name="line.2167"></a>
  2176. <span class="sourceLineNo">2168</span><a name="line.2168"></a>
  2177. <span class="sourceLineNo">2169</span> /**<a name="line.2169"></a>
  2178. <span class="sourceLineNo">2170</span> * Sets the URL generator and sends a {@link PlotChangeEvent} to all<a name="line.2170"></a>
  2179. <span class="sourceLineNo">2171</span> * registered listeners.<a name="line.2171"></a>
  2180. <span class="sourceLineNo">2172</span> *<a name="line.2172"></a>
  2181. <span class="sourceLineNo">2173</span> * @param generator the generator (&lt;code&gt;null&lt;/code&gt; permitted).<a name="line.2173"></a>
  2182. <span class="sourceLineNo">2174</span> *<a name="line.2174"></a>
  2183. <span class="sourceLineNo">2175</span> * @see #getURLGenerator()<a name="line.2175"></a>
  2184. <span class="sourceLineNo">2176</span> */<a name="line.2176"></a>
  2185. <span class="sourceLineNo">2177</span> public void setURLGenerator(PieURLGenerator generator) {<a name="line.2177"></a>
  2186. <span class="sourceLineNo">2178</span> this.urlGenerator = generator;<a name="line.2178"></a>
  2187. <span class="sourceLineNo">2179</span> fireChangeEvent();<a name="line.2179"></a>
  2188. <span class="sourceLineNo">2180</span> }<a name="line.2180"></a>
  2189. <span class="sourceLineNo">2181</span><a name="line.2181"></a>
  2190. <span class="sourceLineNo">2182</span> /**<a name="line.2182"></a>
  2191. <span class="sourceLineNo">2183</span> * Returns the minimum arc angle that will be drawn. Pie sections for an<a name="line.2183"></a>
  2192. <span class="sourceLineNo">2184</span> * angle smaller than this are not drawn, to avoid a JDK bug.<a name="line.2184"></a>
  2193. <span class="sourceLineNo">2185</span> *<a name="line.2185"></a>
  2194. <span class="sourceLineNo">2186</span> * @return The minimum angle.<a name="line.2186"></a>
  2195. <span class="sourceLineNo">2187</span> *<a name="line.2187"></a>
  2196. <span class="sourceLineNo">2188</span> * @see #setMinimumArcAngleToDraw(double)<a name="line.2188"></a>
  2197. <span class="sourceLineNo">2189</span> */<a name="line.2189"></a>
  2198. <span class="sourceLineNo">2190</span> public double getMinimumArcAngleToDraw() {<a name="line.2190"></a>
  2199. <span class="sourceLineNo">2191</span> return this.minimumArcAngleToDraw;<a name="line.2191"></a>
  2200. <span class="sourceLineNo">2192</span> }<a name="line.2192"></a>
  2201. <span class="sourceLineNo">2193</span><a name="line.2193"></a>
  2202. <span class="sourceLineNo">2194</span> /**<a name="line.2194"></a>
  2203. <span class="sourceLineNo">2195</span> * Sets the minimum arc angle that will be drawn. Pie sections for an<a name="line.2195"></a>
  2204. <span class="sourceLineNo">2196</span> * angle smaller than this are not drawn, to avoid a JDK bug. See this<a name="line.2196"></a>
  2205. <span class="sourceLineNo">2197</span> * link for details:<a name="line.2197"></a>
  2206. <span class="sourceLineNo">2198</span> * &lt;br&gt;&lt;br&gt;<a name="line.2198"></a>
  2207. <span class="sourceLineNo">2199</span> * &lt;a href="http://www.jfree.org/phpBB2/viewtopic.php?t=2707"&gt;<a name="line.2199"></a>
  2208. <span class="sourceLineNo">2200</span> * http://www.jfree.org/phpBB2/viewtopic.php?t=2707&lt;/a&gt;<a name="line.2200"></a>
  2209. <span class="sourceLineNo">2201</span> * &lt;br&gt;&lt;br&gt;<a name="line.2201"></a>
  2210. <span class="sourceLineNo">2202</span> * ...and this bug report in the Java Bug Parade:<a name="line.2202"></a>
  2211. <span class="sourceLineNo">2203</span> * &lt;br&gt;&lt;br&gt;<a name="line.2203"></a>
  2212. <span class="sourceLineNo">2204</span> * &lt;a href=<a name="line.2204"></a>
  2213. <span class="sourceLineNo">2205</span> * "http://developer.java.sun.com/developer/bugParade/bugs/4836495.html"&gt;<a name="line.2205"></a>
  2214. <span class="sourceLineNo">2206</span> * http://developer.java.sun.com/developer/bugParade/bugs/4836495.html&lt;/a&gt;<a name="line.2206"></a>
  2215. <span class="sourceLineNo">2207</span> *<a name="line.2207"></a>
  2216. <span class="sourceLineNo">2208</span> * @param angle the minimum angle.<a name="line.2208"></a>
  2217. <span class="sourceLineNo">2209</span> *<a name="line.2209"></a>
  2218. <span class="sourceLineNo">2210</span> * @see #getMinimumArcAngleToDraw()<a name="line.2210"></a>
  2219. <span class="sourceLineNo">2211</span> */<a name="line.2211"></a>
  2220. <span class="sourceLineNo">2212</span> public void setMinimumArcAngleToDraw(double angle) {<a name="line.2212"></a>
  2221. <span class="sourceLineNo">2213</span> this.minimumArcAngleToDraw = angle;<a name="line.2213"></a>
  2222. <span class="sourceLineNo">2214</span> }<a name="line.2214"></a>
  2223. <span class="sourceLineNo">2215</span><a name="line.2215"></a>
  2224. <span class="sourceLineNo">2216</span> /**<a name="line.2216"></a>
  2225. <span class="sourceLineNo">2217</span> * Returns the shape used for legend items.<a name="line.2217"></a>
  2226. <span class="sourceLineNo">2218</span> *<a name="line.2218"></a>
  2227. <span class="sourceLineNo">2219</span> * @return The shape (never &lt;code&gt;null&lt;/code&gt;).<a name="line.2219"></a>
  2228. <span class="sourceLineNo">2220</span> *<a name="line.2220"></a>
  2229. <span class="sourceLineNo">2221</span> * @see #setLegendItemShape(Shape)<a name="line.2221"></a>
  2230. <span class="sourceLineNo">2222</span> */<a name="line.2222"></a>
  2231. <span class="sourceLineNo">2223</span> public Shape getLegendItemShape() {<a name="line.2223"></a>
  2232. <span class="sourceLineNo">2224</span> return this.legendItemShape;<a name="line.2224"></a>
  2233. <span class="sourceLineNo">2225</span> }<a name="line.2225"></a>
  2234. <span class="sourceLineNo">2226</span><a name="line.2226"></a>
  2235. <span class="sourceLineNo">2227</span> /**<a name="line.2227"></a>
  2236. <span class="sourceLineNo">2228</span> * Sets the shape used for legend items and sends a {@link PlotChangeEvent}<a name="line.2228"></a>
  2237. <span class="sourceLineNo">2229</span> * to all registered listeners.<a name="line.2229"></a>
  2238. <span class="sourceLineNo">2230</span> *<a name="line.2230"></a>
  2239. <span class="sourceLineNo">2231</span> * @param shape the shape (&lt;code&gt;null&lt;/code&gt; not permitted).<a name="line.2231"></a>
  2240. <span class="sourceLineNo">2232</span> *<a name="line.2232"></a>
  2241. <span class="sourceLineNo">2233</span> * @see #getLegendItemShape()<a name="line.2233"></a>
  2242. <span class="sourceLineNo">2234</span> */<a name="line.2234"></a>
  2243. <span class="sourceLineNo">2235</span> public void setLegendItemShape(Shape shape) {<a name="line.2235"></a>
  2244. <span class="sourceLineNo">2236</span> ParamChecks.nullNotPermitted(shape, "shape");<a name="line.2236"></a>
  2245. <span class="sourceLineNo">2237</span> this.legendItemShape = shape;<a name="line.2237"></a>
  2246. <span class="sourceLineNo">2238</span> fireChangeEvent();<a name="line.2238"></a>
  2247. <span class="sourceLineNo">2239</span> }<a name="line.2239"></a>
  2248. <span class="sourceLineNo">2240</span><a name="line.2240"></a>
  2249. <span class="sourceLineNo">2241</span> /**<a name="line.2241"></a>
  2250. <span class="sourceLineNo">2242</span> * Returns the legend label generator.<a name="line.2242"></a>
  2251. <span class="sourceLineNo">2243</span> *<a name="line.2243"></a>
  2252. <span class="sourceLineNo">2244</span> * @return The legend label generator (never &lt;code&gt;null&lt;/code&gt;).<a name="line.2244"></a>
  2253. <span class="sourceLineNo">2245</span> *<a name="line.2245"></a>
  2254. <span class="sourceLineNo">2246</span> * @see #setLegendLabelGenerator(PieSectionLabelGenerator)<a name="line.2246"></a>
  2255. <span class="sourceLineNo">2247</span> */<a name="line.2247"></a>
  2256. <span class="sourceLineNo">2248</span> public PieSectionLabelGenerator getLegendLabelGenerator() {<a name="line.2248"></a>
  2257. <span class="sourceLineNo">2249</span> return this.legendLabelGenerator;<a name="line.2249"></a>
  2258. <span class="sourceLineNo">2250</span> }<a name="line.2250"></a>
  2259. <span class="sourceLineNo">2251</span><a name="line.2251"></a>
  2260. <span class="sourceLineNo">2252</span> /**<a name="line.2252"></a>
  2261. <span class="sourceLineNo">2253</span> * Sets the legend label generator and sends a {@link PlotChangeEvent} to<a name="line.2253"></a>
  2262. <span class="sourceLineNo">2254</span> * all registered listeners.<a name="line.2254"></a>
  2263. <span class="sourceLineNo">2255</span> *<a name="line.2255"></a>
  2264. <span class="sourceLineNo">2256</span> * @param generator the generator (&lt;code&gt;null&lt;/code&gt; not permitted).<a name="line.2256"></a>
  2265. <span class="sourceLineNo">2257</span> *<a name="line.2257"></a>
  2266. <span class="sourceLineNo">2258</span> * @see #getLegendLabelGenerator()<a name="line.2258"></a>
  2267. <span class="sourceLineNo">2259</span> */<a name="line.2259"></a>
  2268. <span class="sourceLineNo">2260</span> public void setLegendLabelGenerator(PieSectionLabelGenerator generator) {<a name="line.2260"></a>
  2269. <span class="sourceLineNo">2261</span> ParamChecks.nullNotPermitted(generator, "generator");<a name="line.2261"></a>
  2270. <span class="sourceLineNo">2262</span> this.legendLabelGenerator = generator;<a name="line.2262"></a>
  2271. <span class="sourceLineNo">2263</span> fireChangeEvent();<a name="line.2263"></a>
  2272. <span class="sourceLineNo">2264</span> }<a name="line.2264"></a>
  2273. <span class="sourceLineNo">2265</span><a name="line.2265"></a>
  2274. <span class="sourceLineNo">2266</span> /**<a name="line.2266"></a>
  2275. <span class="sourceLineNo">2267</span> * Returns the legend label tool tip generator.<a name="line.2267"></a>
  2276. <span class="sourceLineNo">2268</span> *<a name="line.2268"></a>
  2277. <span class="sourceLineNo">2269</span> * @return The legend label tool tip generator (possibly &lt;code&gt;null&lt;/code&gt;).<a name="line.2269"></a>
  2278. <span class="sourceLineNo">2270</span> *<a name="line.2270"></a>
  2279. <span class="sourceLineNo">2271</span> * @see #setLegendLabelToolTipGenerator(PieSectionLabelGenerator)<a name="line.2271"></a>
  2280. <span class="sourceLineNo">2272</span> */<a name="line.2272"></a>
  2281. <span class="sourceLineNo">2273</span> public PieSectionLabelGenerator getLegendLabelToolTipGenerator() {<a name="line.2273"></a>
  2282. <span class="sourceLineNo">2274</span> return this.legendLabelToolTipGenerator;<a name="line.2274"></a>
  2283. <span class="sourceLineNo">2275</span> }<a name="line.2275"></a>
  2284. <span class="sourceLineNo">2276</span><a name="line.2276"></a>
  2285. <span class="sourceLineNo">2277</span> /**<a name="line.2277"></a>
  2286. <span class="sourceLineNo">2278</span> * Sets the legend label tool tip generator and sends a<a name="line.2278"></a>
  2287. <span class="sourceLineNo">2279</span> * {@link PlotChangeEvent} to all registered listeners.<a name="line.2279"></a>
  2288. <span class="sourceLineNo">2280</span> *<a name="line.2280"></a>
  2289. <span class="sourceLineNo">2281</span> * @param generator the generator (&lt;code&gt;null&lt;/code&gt; permitted).<a name="line.2281"></a>
  2290. <span class="sourceLineNo">2282</span> *<a name="line.2282"></a>
  2291. <span class="sourceLineNo">2283</span> * @see #getLegendLabelToolTipGenerator()<a name="line.2283"></a>
  2292. <span class="sourceLineNo">2284</span> */<a name="line.2284"></a>
  2293. <span class="sourceLineNo">2285</span> public void setLegendLabelToolTipGenerator(<a name="line.2285"></a>
  2294. <span class="sourceLineNo">2286</span> PieSectionLabelGenerator generator) {<a name="line.2286"></a>
  2295. <span class="sourceLineNo">2287</span> this.legendLabelToolTipGenerator = generator;<a name="line.2287"></a>
  2296. <span class="sourceLineNo">2288</span> fireChangeEvent();<a name="line.2288"></a>
  2297. <span class="sourceLineNo">2289</span> }<a name="line.2289"></a>
  2298. <span class="sourceLineNo">2290</span><a name="line.2290"></a>
  2299. <span class="sourceLineNo">2291</span> /**<a name="line.2291"></a>
  2300. <span class="sourceLineNo">2292</span> * Returns the legend label URL generator.<a name="line.2292"></a>
  2301. <span class="sourceLineNo">2293</span> *<a name="line.2293"></a>
  2302. <span class="sourceLineNo">2294</span> * @return The legend label URL generator (possibly &lt;code&gt;null&lt;/code&gt;).<a name="line.2294"></a>
  2303. <span class="sourceLineNo">2295</span> *<a name="line.2295"></a>
  2304. <span class="sourceLineNo">2296</span> * @see #setLegendLabelURLGenerator(PieURLGenerator)<a name="line.2296"></a>
  2305. <span class="sourceLineNo">2297</span> *<a name="line.2297"></a>
  2306. <span class="sourceLineNo">2298</span> * @since 1.0.4<a name="line.2298"></a>
  2307. <span class="sourceLineNo">2299</span> */<a name="line.2299"></a>
  2308. <span class="sourceLineNo">2300</span> public PieURLGenerator getLegendLabelURLGenerator() {<a name="line.2300"></a>
  2309. <span class="sourceLineNo">2301</span> return this.legendLabelURLGenerator;<a name="line.2301"></a>
  2310. <span class="sourceLineNo">2302</span> }<a name="line.2302"></a>
  2311. <span class="sourceLineNo">2303</span><a name="line.2303"></a>
  2312. <span class="sourceLineNo">2304</span> /**<a name="line.2304"></a>
  2313. <span class="sourceLineNo">2305</span> * Sets the legend label URL generator and sends a<a name="line.2305"></a>
  2314. <span class="sourceLineNo">2306</span> * {@link PlotChangeEvent} to all registered listeners.<a name="line.2306"></a>
  2315. <span class="sourceLineNo">2307</span> *<a name="line.2307"></a>
  2316. <span class="sourceLineNo">2308</span> * @param generator the generator (&lt;code&gt;null&lt;/code&gt; permitted).<a name="line.2308"></a>
  2317. <span class="sourceLineNo">2309</span> *<a name="line.2309"></a>
  2318. <span class="sourceLineNo">2310</span> * @see #getLegendLabelURLGenerator()<a name="line.2310"></a>
  2319. <span class="sourceLineNo">2311</span> *<a name="line.2311"></a>
  2320. <span class="sourceLineNo">2312</span> * @since 1.0.4<a name="line.2312"></a>
  2321. <span class="sourceLineNo">2313</span> */<a name="line.2313"></a>
  2322. <span class="sourceLineNo">2314</span> public void setLegendLabelURLGenerator(PieURLGenerator generator) {<a name="line.2314"></a>
  2323. <span class="sourceLineNo">2315</span> this.legendLabelURLGenerator = generator;<a name="line.2315"></a>
  2324. <span class="sourceLineNo">2316</span> fireChangeEvent();<a name="line.2316"></a>
  2325. <span class="sourceLineNo">2317</span> }<a name="line.2317"></a>
  2326. <span class="sourceLineNo">2318</span><a name="line.2318"></a>
  2327. <span class="sourceLineNo">2319</span> /**<a name="line.2319"></a>
  2328. <span class="sourceLineNo">2320</span> * Returns the shadow generator for the plot, if any.<a name="line.2320"></a>
  2329. <span class="sourceLineNo">2321</span> * <a name="line.2321"></a>
  2330. <span class="sourceLineNo">2322</span> * @return The shadow generator (possibly &lt;code&gt;null&lt;/code&gt;).<a name="line.2322"></a>
  2331. <span class="sourceLineNo">2323</span> * <a name="line.2323"></a>
  2332. <span class="sourceLineNo">2324</span> * @since 1.0.14<a name="line.2324"></a>
  2333. <span class="sourceLineNo">2325</span> */<a name="line.2325"></a>
  2334. <span class="sourceLineNo">2326</span> public ShadowGenerator getShadowGenerator() {<a name="line.2326"></a>
  2335. <span class="sourceLineNo">2327</span> return this.shadowGenerator;<a name="line.2327"></a>
  2336. <span class="sourceLineNo">2328</span> }<a name="line.2328"></a>
  2337. <span class="sourceLineNo">2329</span><a name="line.2329"></a>
  2338. <span class="sourceLineNo">2330</span> /**<a name="line.2330"></a>
  2339. <span class="sourceLineNo">2331</span> * Sets the shadow generator for the plot and sends a<a name="line.2331"></a>
  2340. <span class="sourceLineNo">2332</span> * {@link PlotChangeEvent} to all registered listeners. Note that this is<a name="line.2332"></a>
  2341. <span class="sourceLineNo">2333</span> * a bitmap drop-shadow generation facility and is separate from the<a name="line.2333"></a>
  2342. <span class="sourceLineNo">2334</span> * vector based show option that is controlled via the<a name="line.2334"></a>
  2343. <span class="sourceLineNo">2335</span> * {@link #setShadowPaint(java.awt.Paint)} method.<a name="line.2335"></a>
  2344. <span class="sourceLineNo">2336</span> *<a name="line.2336"></a>
  2345. <span class="sourceLineNo">2337</span> * @param generator the generator (&lt;code&gt;null&lt;/code&gt; permitted).<a name="line.2337"></a>
  2346. <span class="sourceLineNo">2338</span> *<a name="line.2338"></a>
  2347. <span class="sourceLineNo">2339</span> * @since 1.0.14<a name="line.2339"></a>
  2348. <span class="sourceLineNo">2340</span> */<a name="line.2340"></a>
  2349. <span class="sourceLineNo">2341</span> public void setShadowGenerator(ShadowGenerator generator) {<a name="line.2341"></a>
  2350. <span class="sourceLineNo">2342</span> this.shadowGenerator = generator;<a name="line.2342"></a>
  2351. <span class="sourceLineNo">2343</span> fireChangeEvent();<a name="line.2343"></a>
  2352. <span class="sourceLineNo">2344</span> }<a name="line.2344"></a>
  2353. <span class="sourceLineNo">2345</span><a name="line.2345"></a>
  2354. <span class="sourceLineNo">2346</span> /**<a name="line.2346"></a>
  2355. <span class="sourceLineNo">2347</span> * Handles a mouse wheel rotation (this method is intended for use by the<a name="line.2347"></a>
  2356. <span class="sourceLineNo">2348</span> * {@code MouseWheelHandler} class).<a name="line.2348"></a>
  2357. <span class="sourceLineNo">2349</span> *<a name="line.2349"></a>
  2358. <span class="sourceLineNo">2350</span> * @param rotateClicks the number of rotate clicks on the the mouse wheel.<a name="line.2350"></a>
  2359. <span class="sourceLineNo">2351</span> *<a name="line.2351"></a>
  2360. <span class="sourceLineNo">2352</span> * @since 1.0.14<a name="line.2352"></a>
  2361. <span class="sourceLineNo">2353</span> */<a name="line.2353"></a>
  2362. <span class="sourceLineNo">2354</span> public void handleMouseWheelRotation(int rotateClicks) {<a name="line.2354"></a>
  2363. <span class="sourceLineNo">2355</span> setStartAngle(this.startAngle + rotateClicks * 4.0);<a name="line.2355"></a>
  2364. <span class="sourceLineNo">2356</span> }<a name="line.2356"></a>
  2365. <span class="sourceLineNo">2357</span><a name="line.2357"></a>
  2366. <span class="sourceLineNo">2358</span> /**<a name="line.2358"></a>
  2367. <span class="sourceLineNo">2359</span> * Initialises the drawing procedure. This method will be called before<a name="line.2359"></a>
  2368. <span class="sourceLineNo">2360</span> * the first item is rendered, giving the plot an opportunity to initialise<a name="line.2360"></a>
  2369. <span class="sourceLineNo">2361</span> * any state information it wants to maintain.<a name="line.2361"></a>
  2370. <span class="sourceLineNo">2362</span> *<a name="line.2362"></a>
  2371. <span class="sourceLineNo">2363</span> * @param g2 the graphics device.<a name="line.2363"></a>
  2372. <span class="sourceLineNo">2364</span> * @param plotArea the plot area (&lt;code&gt;null&lt;/code&gt; not permitted).<a name="line.2364"></a>
  2373. <span class="sourceLineNo">2365</span> * @param plot the plot.<a name="line.2365"></a>
  2374. <span class="sourceLineNo">2366</span> * @param index the secondary index (&lt;code&gt;null&lt;/code&gt; for primary<a name="line.2366"></a>
  2375. <span class="sourceLineNo">2367</span> * renderer).<a name="line.2367"></a>
  2376. <span class="sourceLineNo">2368</span> * @param info collects chart rendering information for return to caller.<a name="line.2368"></a>
  2377. <span class="sourceLineNo">2369</span> *<a name="line.2369"></a>
  2378. <span class="sourceLineNo">2370</span> * @return A state object (maintains state information relevant to one<a name="line.2370"></a>
  2379. <span class="sourceLineNo">2371</span> * chart drawing).<a name="line.2371"></a>
  2380. <span class="sourceLineNo">2372</span> */<a name="line.2372"></a>
  2381. <span class="sourceLineNo">2373</span> public PiePlotState initialise(Graphics2D g2, Rectangle2D plotArea,<a name="line.2373"></a>
  2382. <span class="sourceLineNo">2374</span> PiePlot plot, Integer index, PlotRenderingInfo info) {<a name="line.2374"></a>
  2383. <span class="sourceLineNo">2375</span><a name="line.2375"></a>
  2384. <span class="sourceLineNo">2376</span> PiePlotState state = new PiePlotState(info);<a name="line.2376"></a>
  2385. <span class="sourceLineNo">2377</span> state.setPassesRequired(2);<a name="line.2377"></a>
  2386. <span class="sourceLineNo">2378</span> if (this.dataset != null) {<a name="line.2378"></a>
  2387. <span class="sourceLineNo">2379</span> state.setTotal(DatasetUtilities.calculatePieDatasetTotal(<a name="line.2379"></a>
  2388. <span class="sourceLineNo">2380</span> plot.getDataset()));<a name="line.2380"></a>
  2389. <span class="sourceLineNo">2381</span> }<a name="line.2381"></a>
  2390. <span class="sourceLineNo">2382</span> state.setLatestAngle(plot.getStartAngle());<a name="line.2382"></a>
  2391. <span class="sourceLineNo">2383</span> return state;<a name="line.2383"></a>
  2392. <span class="sourceLineNo">2384</span><a name="line.2384"></a>
  2393. <span class="sourceLineNo">2385</span> }<a name="line.2385"></a>
  2394. <span class="sourceLineNo">2386</span><a name="line.2386"></a>
  2395. <span class="sourceLineNo">2387</span> /**<a name="line.2387"></a>
  2396. <span class="sourceLineNo">2388</span> * Draws the plot on a Java 2D graphics device (such as the screen or a<a name="line.2388"></a>
  2397. <span class="sourceLineNo">2389</span> * printer).<a name="line.2389"></a>
  2398. <span class="sourceLineNo">2390</span> *<a name="line.2390"></a>
  2399. <span class="sourceLineNo">2391</span> * @param g2 the graphics device.<a name="line.2391"></a>
  2400. <span class="sourceLineNo">2392</span> * @param area the area within which the plot should be drawn.<a name="line.2392"></a>
  2401. <span class="sourceLineNo">2393</span> * @param anchor the anchor point (&lt;code&gt;null&lt;/code&gt; permitted).<a name="line.2393"></a>
  2402. <span class="sourceLineNo">2394</span> * @param parentState the state from the parent plot, if there is one.<a name="line.2394"></a>
  2403. <span class="sourceLineNo">2395</span> * @param info collects info about the drawing<a name="line.2395"></a>
  2404. <span class="sourceLineNo">2396</span> * (&lt;code&gt;null&lt;/code&gt; permitted).<a name="line.2396"></a>
  2405. <span class="sourceLineNo">2397</span> */<a name="line.2397"></a>
  2406. <span class="sourceLineNo">2398</span> @Override<a name="line.2398"></a>
  2407. <span class="sourceLineNo">2399</span> public void draw(Graphics2D g2, Rectangle2D area, Point2D anchor,<a name="line.2399"></a>
  2408. <span class="sourceLineNo">2400</span> PlotState parentState, PlotRenderingInfo info) {<a name="line.2400"></a>
  2409. <span class="sourceLineNo">2401</span><a name="line.2401"></a>
  2410. <span class="sourceLineNo">2402</span> // adjust for insets...<a name="line.2402"></a>
  2411. <span class="sourceLineNo">2403</span> RectangleInsets insets = getInsets();<a name="line.2403"></a>
  2412. <span class="sourceLineNo">2404</span> insets.trim(area);<a name="line.2404"></a>
  2413. <span class="sourceLineNo">2405</span><a name="line.2405"></a>
  2414. <span class="sourceLineNo">2406</span> if (info != null) {<a name="line.2406"></a>
  2415. <span class="sourceLineNo">2407</span> info.setPlotArea(area);<a name="line.2407"></a>
  2416. <span class="sourceLineNo">2408</span> info.setDataArea(area);<a name="line.2408"></a>
  2417. <span class="sourceLineNo">2409</span> }<a name="line.2409"></a>
  2418. <span class="sourceLineNo">2410</span><a name="line.2410"></a>
  2419. <span class="sourceLineNo">2411</span> drawBackground(g2, area);<a name="line.2411"></a>
  2420. <span class="sourceLineNo">2412</span> drawOutline(g2, area);<a name="line.2412"></a>
  2421. <span class="sourceLineNo">2413</span><a name="line.2413"></a>
  2422. <span class="sourceLineNo">2414</span> Shape savedClip = g2.getClip();<a name="line.2414"></a>
  2423. <span class="sourceLineNo">2415</span> g2.clip(area);<a name="line.2415"></a>
  2424. <span class="sourceLineNo">2416</span><a name="line.2416"></a>
  2425. <span class="sourceLineNo">2417</span> Composite originalComposite = g2.getComposite();<a name="line.2417"></a>
  2426. <span class="sourceLineNo">2418</span> g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,<a name="line.2418"></a>
  2427. <span class="sourceLineNo">2419</span> getForegroundAlpha()));<a name="line.2419"></a>
  2428. <span class="sourceLineNo">2420</span><a name="line.2420"></a>
  2429. <span class="sourceLineNo">2421</span> if (!DatasetUtilities.isEmptyOrNull(this.dataset)) {<a name="line.2421"></a>
  2430. <span class="sourceLineNo">2422</span> Graphics2D savedG2 = g2;<a name="line.2422"></a>
  2431. <span class="sourceLineNo">2423</span> boolean suppressShadow = Boolean.TRUE.equals(g2.getRenderingHint(<a name="line.2423"></a>
  2432. <span class="sourceLineNo">2424</span> JFreeChart.KEY_SUPPRESS_SHADOW_GENERATION));<a name="line.2424"></a>
  2433. <span class="sourceLineNo">2425</span> BufferedImage dataImage = null;<a name="line.2425"></a>
  2434. <span class="sourceLineNo">2426</span> if (this.shadowGenerator != null &amp;&amp; !suppressShadow) {<a name="line.2426"></a>
  2435. <span class="sourceLineNo">2427</span> dataImage = new BufferedImage((int) area.getWidth(),<a name="line.2427"></a>
  2436. <span class="sourceLineNo">2428</span> (int) area.getHeight(), BufferedImage.TYPE_INT_ARGB);<a name="line.2428"></a>
  2437. <span class="sourceLineNo">2429</span> g2 = dataImage.createGraphics();<a name="line.2429"></a>
  2438. <span class="sourceLineNo">2430</span> g2.translate(-area.getX(), -area.getY());<a name="line.2430"></a>
  2439. <span class="sourceLineNo">2431</span> g2.setRenderingHints(savedG2.getRenderingHints());<a name="line.2431"></a>
  2440. <span class="sourceLineNo">2432</span> }<a name="line.2432"></a>
  2441. <span class="sourceLineNo">2433</span> drawPie(g2, area, info);<a name="line.2433"></a>
  2442. <span class="sourceLineNo">2434</span> if (this.shadowGenerator != null &amp;&amp; !suppressShadow) {<a name="line.2434"></a>
  2443. <span class="sourceLineNo">2435</span> BufferedImage shadowImage <a name="line.2435"></a>
  2444. <span class="sourceLineNo">2436</span> = this.shadowGenerator.createDropShadow(dataImage);<a name="line.2436"></a>
  2445. <span class="sourceLineNo">2437</span> g2 = savedG2;<a name="line.2437"></a>
  2446. <span class="sourceLineNo">2438</span> g2.drawImage(shadowImage, (int) area.getX() <a name="line.2438"></a>
  2447. <span class="sourceLineNo">2439</span> + this.shadowGenerator.calculateOffsetX(), <a name="line.2439"></a>
  2448. <span class="sourceLineNo">2440</span> (int) area.getY()<a name="line.2440"></a>
  2449. <span class="sourceLineNo">2441</span> + this.shadowGenerator.calculateOffsetY(), null);<a name="line.2441"></a>
  2450. <span class="sourceLineNo">2442</span> g2.drawImage(dataImage, (int) area.getX(), (int) area.getY(), <a name="line.2442"></a>
  2451. <span class="sourceLineNo">2443</span> null);<a name="line.2443"></a>
  2452. <span class="sourceLineNo">2444</span> }<a name="line.2444"></a>
  2453. <span class="sourceLineNo">2445</span> }<a name="line.2445"></a>
  2454. <span class="sourceLineNo">2446</span> else {<a name="line.2446"></a>
  2455. <span class="sourceLineNo">2447</span> drawNoDataMessage(g2, area);<a name="line.2447"></a>
  2456. <span class="sourceLineNo">2448</span> }<a name="line.2448"></a>
  2457. <span class="sourceLineNo">2449</span><a name="line.2449"></a>
  2458. <span class="sourceLineNo">2450</span> g2.setClip(savedClip);<a name="line.2450"></a>
  2459. <span class="sourceLineNo">2451</span> g2.setComposite(originalComposite);<a name="line.2451"></a>
  2460. <span class="sourceLineNo">2452</span><a name="line.2452"></a>
  2461. <span class="sourceLineNo">2453</span> drawOutline(g2, area);<a name="line.2453"></a>
  2462. <span class="sourceLineNo">2454</span><a name="line.2454"></a>
  2463. <span class="sourceLineNo">2455</span> }<a name="line.2455"></a>
  2464. <span class="sourceLineNo">2456</span><a name="line.2456"></a>
  2465. <span class="sourceLineNo">2457</span> /**<a name="line.2457"></a>
  2466. <span class="sourceLineNo">2458</span> * Draws the pie.<a name="line.2458"></a>
  2467. <span class="sourceLineNo">2459</span> *<a name="line.2459"></a>
  2468. <span class="sourceLineNo">2460</span> * @param g2 the graphics device.<a name="line.2460"></a>
  2469. <span class="sourceLineNo">2461</span> * @param plotArea the plot area.<a name="line.2461"></a>
  2470. <span class="sourceLineNo">2462</span> * @param info chart rendering info.<a name="line.2462"></a>
  2471. <span class="sourceLineNo">2463</span> */<a name="line.2463"></a>
  2472. <span class="sourceLineNo">2464</span> protected void drawPie(Graphics2D g2, Rectangle2D plotArea,<a name="line.2464"></a>
  2473. <span class="sourceLineNo">2465</span> PlotRenderingInfo info) {<a name="line.2465"></a>
  2474. <span class="sourceLineNo">2466</span><a name="line.2466"></a>
  2475. <span class="sourceLineNo">2467</span> PiePlotState state = initialise(g2, plotArea, this, null, info);<a name="line.2467"></a>
  2476. <span class="sourceLineNo">2468</span><a name="line.2468"></a>
  2477. <span class="sourceLineNo">2469</span> // adjust the plot area for interior spacing and labels...<a name="line.2469"></a>
  2478. <span class="sourceLineNo">2470</span> double labelReserve = 0.0;<a name="line.2470"></a>
  2479. <span class="sourceLineNo">2471</span> if (this.labelGenerator != null &amp;&amp; !this.simpleLabels) {<a name="line.2471"></a>
  2480. <span class="sourceLineNo">2472</span> labelReserve = this.labelGap + this.maximumLabelWidth;<a name="line.2472"></a>
  2481. <span class="sourceLineNo">2473</span> }<a name="line.2473"></a>
  2482. <span class="sourceLineNo">2474</span> double gapHorizontal = plotArea.getWidth() * labelReserve * 2.0;<a name="line.2474"></a>
  2483. <span class="sourceLineNo">2475</span> double gapVertical = plotArea.getHeight() * this.interiorGap * 2.0;<a name="line.2475"></a>
  2484. <span class="sourceLineNo">2476</span><a name="line.2476"></a>
  2485. <span class="sourceLineNo">2477</span><a name="line.2477"></a>
  2486. <span class="sourceLineNo">2478</span> if (DEBUG_DRAW_INTERIOR) {<a name="line.2478"></a>
  2487. <span class="sourceLineNo">2479</span> double hGap = plotArea.getWidth() * this.interiorGap;<a name="line.2479"></a>
  2488. <span class="sourceLineNo">2480</span> double vGap = plotArea.getHeight() * this.interiorGap;<a name="line.2480"></a>
  2489. <span class="sourceLineNo">2481</span><a name="line.2481"></a>
  2490. <span class="sourceLineNo">2482</span> double igx1 = plotArea.getX() + hGap;<a name="line.2482"></a>
  2491. <span class="sourceLineNo">2483</span> double igx2 = plotArea.getMaxX() - hGap;<a name="line.2483"></a>
  2492. <span class="sourceLineNo">2484</span> double igy1 = plotArea.getY() + vGap;<a name="line.2484"></a>
  2493. <span class="sourceLineNo">2485</span> double igy2 = plotArea.getMaxY() - vGap;<a name="line.2485"></a>
  2494. <span class="sourceLineNo">2486</span> g2.setPaint(Color.gray);<a name="line.2486"></a>
  2495. <span class="sourceLineNo">2487</span> g2.draw(new Rectangle2D.Double(igx1, igy1, igx2 - igx1,<a name="line.2487"></a>
  2496. <span class="sourceLineNo">2488</span> igy2 - igy1));<a name="line.2488"></a>
  2497. <span class="sourceLineNo">2489</span> }<a name="line.2489"></a>
  2498. <span class="sourceLineNo">2490</span><a name="line.2490"></a>
  2499. <span class="sourceLineNo">2491</span> double linkX = plotArea.getX() + gapHorizontal / 2;<a name="line.2491"></a>
  2500. <span class="sourceLineNo">2492</span> double linkY = plotArea.getY() + gapVertical / 2;<a name="line.2492"></a>
  2501. <span class="sourceLineNo">2493</span> double linkW = plotArea.getWidth() - gapHorizontal;<a name="line.2493"></a>
  2502. <span class="sourceLineNo">2494</span> double linkH = plotArea.getHeight() - gapVertical;<a name="line.2494"></a>
  2503. <span class="sourceLineNo">2495</span><a name="line.2495"></a>
  2504. <span class="sourceLineNo">2496</span> // make the link area a square if the pie chart is to be circular...<a name="line.2496"></a>
  2505. <span class="sourceLineNo">2497</span> if (this.circular) {<a name="line.2497"></a>
  2506. <span class="sourceLineNo">2498</span> double min = Math.min(linkW, linkH) / 2;<a name="line.2498"></a>
  2507. <span class="sourceLineNo">2499</span> linkX = (linkX + linkX + linkW) / 2 - min;<a name="line.2499"></a>
  2508. <span class="sourceLineNo">2500</span> linkY = (linkY + linkY + linkH) / 2 - min;<a name="line.2500"></a>
  2509. <span class="sourceLineNo">2501</span> linkW = 2 * min;<a name="line.2501"></a>
  2510. <span class="sourceLineNo">2502</span> linkH = 2 * min;<a name="line.2502"></a>
  2511. <span class="sourceLineNo">2503</span> }<a name="line.2503"></a>
  2512. <span class="sourceLineNo">2504</span><a name="line.2504"></a>
  2513. <span class="sourceLineNo">2505</span> // the link area defines the dog leg points for the linking lines to<a name="line.2505"></a>
  2514. <span class="sourceLineNo">2506</span> // the labels<a name="line.2506"></a>
  2515. <span class="sourceLineNo">2507</span> Rectangle2D linkArea = new Rectangle2D.Double(linkX, linkY, linkW,<a name="line.2507"></a>
  2516. <span class="sourceLineNo">2508</span> linkH);<a name="line.2508"></a>
  2517. <span class="sourceLineNo">2509</span> state.setLinkArea(linkArea);<a name="line.2509"></a>
  2518. <span class="sourceLineNo">2510</span><a name="line.2510"></a>
  2519. <span class="sourceLineNo">2511</span> if (DEBUG_DRAW_LINK_AREA) {<a name="line.2511"></a>
  2520. <span class="sourceLineNo">2512</span> g2.setPaint(Color.blue);<a name="line.2512"></a>
  2521. <span class="sourceLineNo">2513</span> g2.draw(linkArea);<a name="line.2513"></a>
  2522. <span class="sourceLineNo">2514</span> g2.setPaint(Color.yellow);<a name="line.2514"></a>
  2523. <span class="sourceLineNo">2515</span> g2.draw(new Ellipse2D.Double(linkArea.getX(), linkArea.getY(),<a name="line.2515"></a>
  2524. <span class="sourceLineNo">2516</span> linkArea.getWidth(), linkArea.getHeight()));<a name="line.2516"></a>
  2525. <span class="sourceLineNo">2517</span> }<a name="line.2517"></a>
  2526. <span class="sourceLineNo">2518</span><a name="line.2518"></a>
  2527. <span class="sourceLineNo">2519</span> // the explode area defines the max circle/ellipse for the exploded<a name="line.2519"></a>
  2528. <span class="sourceLineNo">2520</span> // pie sections. it is defined by shrinking the linkArea by the<a name="line.2520"></a>
  2529. <span class="sourceLineNo">2521</span> // linkMargin factor.<a name="line.2521"></a>
  2530. <span class="sourceLineNo">2522</span> double lm = 0.0;<a name="line.2522"></a>
  2531. <span class="sourceLineNo">2523</span> if (!this.simpleLabels) {<a name="line.2523"></a>
  2532. <span class="sourceLineNo">2524</span> lm = this.labelLinkMargin;<a name="line.2524"></a>
  2533. <span class="sourceLineNo">2525</span> }<a name="line.2525"></a>
  2534. <span class="sourceLineNo">2526</span> double hh = linkArea.getWidth() * lm * 2.0;<a name="line.2526"></a>
  2535. <span class="sourceLineNo">2527</span> double vv = linkArea.getHeight() * lm * 2.0;<a name="line.2527"></a>
  2536. <span class="sourceLineNo">2528</span> Rectangle2D explodeArea = new Rectangle2D.Double(linkX + hh / 2.0,<a name="line.2528"></a>
  2537. <span class="sourceLineNo">2529</span> linkY + vv / 2.0, linkW - hh, linkH - vv);<a name="line.2529"></a>
  2538. <span class="sourceLineNo">2530</span><a name="line.2530"></a>
  2539. <span class="sourceLineNo">2531</span> state.setExplodedPieArea(explodeArea);<a name="line.2531"></a>
  2540. <span class="sourceLineNo">2532</span><a name="line.2532"></a>
  2541. <span class="sourceLineNo">2533</span> // the pie area defines the circle/ellipse for regular pie sections.<a name="line.2533"></a>
  2542. <span class="sourceLineNo">2534</span> // it is defined by shrinking the explodeArea by the explodeMargin<a name="line.2534"></a>
  2543. <span class="sourceLineNo">2535</span> // factor.<a name="line.2535"></a>
  2544. <span class="sourceLineNo">2536</span> double maximumExplodePercent = getMaximumExplodePercent();<a name="line.2536"></a>
  2545. <span class="sourceLineNo">2537</span> double percent = maximumExplodePercent / (1.0 + maximumExplodePercent);<a name="line.2537"></a>
  2546. <span class="sourceLineNo">2538</span><a name="line.2538"></a>
  2547. <span class="sourceLineNo">2539</span> double h1 = explodeArea.getWidth() * percent;<a name="line.2539"></a>
  2548. <span class="sourceLineNo">2540</span> double v1 = explodeArea.getHeight() * percent;<a name="line.2540"></a>
  2549. <span class="sourceLineNo">2541</span> Rectangle2D pieArea = new Rectangle2D.Double(explodeArea.getX()<a name="line.2541"></a>
  2550. <span class="sourceLineNo">2542</span> + h1 / 2.0, explodeArea.getY() + v1 / 2.0,<a name="line.2542"></a>
  2551. <span class="sourceLineNo">2543</span> explodeArea.getWidth() - h1, explodeArea.getHeight() - v1);<a name="line.2543"></a>
  2552. <span class="sourceLineNo">2544</span><a name="line.2544"></a>
  2553. <span class="sourceLineNo">2545</span> if (DEBUG_DRAW_PIE_AREA) {<a name="line.2545"></a>
  2554. <span class="sourceLineNo">2546</span> g2.setPaint(Color.green);<a name="line.2546"></a>
  2555. <span class="sourceLineNo">2547</span> g2.draw(pieArea);<a name="line.2547"></a>
  2556. <span class="sourceLineNo">2548</span> }<a name="line.2548"></a>
  2557. <span class="sourceLineNo">2549</span> state.setPieArea(pieArea);<a name="line.2549"></a>
  2558. <span class="sourceLineNo">2550</span> state.setPieCenterX(pieArea.getCenterX());<a name="line.2550"></a>
  2559. <span class="sourceLineNo">2551</span> state.setPieCenterY(pieArea.getCenterY());<a name="line.2551"></a>
  2560. <span class="sourceLineNo">2552</span> state.setPieWRadius(pieArea.getWidth() / 2.0);<a name="line.2552"></a>
  2561. <span class="sourceLineNo">2553</span> state.setPieHRadius(pieArea.getHeight() / 2.0);<a name="line.2553"></a>
  2562. <span class="sourceLineNo">2554</span><a name="line.2554"></a>
  2563. <span class="sourceLineNo">2555</span> // plot the data (unless the dataset is null)...<a name="line.2555"></a>
  2564. <span class="sourceLineNo">2556</span> if ((this.dataset != null) &amp;&amp; (this.dataset.getKeys().size() &gt; 0)) {<a name="line.2556"></a>
  2565. <span class="sourceLineNo">2557</span><a name="line.2557"></a>
  2566. <span class="sourceLineNo">2558</span> List keys = this.dataset.getKeys();<a name="line.2558"></a>
  2567. <span class="sourceLineNo">2559</span> double totalValue = DatasetUtilities.calculatePieDatasetTotal(<a name="line.2559"></a>
  2568. <span class="sourceLineNo">2560</span> this.dataset);<a name="line.2560"></a>
  2569. <span class="sourceLineNo">2561</span><a name="line.2561"></a>
  2570. <span class="sourceLineNo">2562</span> int passesRequired = state.getPassesRequired();<a name="line.2562"></a>
  2571. <span class="sourceLineNo">2563</span> for (int pass = 0; pass &lt; passesRequired; pass++) {<a name="line.2563"></a>
  2572. <span class="sourceLineNo">2564</span> double runningTotal = 0.0;<a name="line.2564"></a>
  2573. <span class="sourceLineNo">2565</span> for (int section = 0; section &lt; keys.size(); section++) {<a name="line.2565"></a>
  2574. <span class="sourceLineNo">2566</span> Number n = this.dataset.getValue(section);<a name="line.2566"></a>
  2575. <span class="sourceLineNo">2567</span> if (n != null) {<a name="line.2567"></a>
  2576. <span class="sourceLineNo">2568</span> double value = n.doubleValue();<a name="line.2568"></a>
  2577. <span class="sourceLineNo">2569</span> if (value &gt; 0.0) {<a name="line.2569"></a>
  2578. <span class="sourceLineNo">2570</span> runningTotal += value;<a name="line.2570"></a>
  2579. <span class="sourceLineNo">2571</span> drawItem(g2, section, explodeArea, state, pass);<a name="line.2571"></a>
  2580. <span class="sourceLineNo">2572</span> }<a name="line.2572"></a>
  2581. <span class="sourceLineNo">2573</span> }<a name="line.2573"></a>
  2582. <span class="sourceLineNo">2574</span> }<a name="line.2574"></a>
  2583. <span class="sourceLineNo">2575</span> }<a name="line.2575"></a>
  2584. <span class="sourceLineNo">2576</span> if (this.simpleLabels) {<a name="line.2576"></a>
  2585. <span class="sourceLineNo">2577</span> drawSimpleLabels(g2, keys, totalValue, plotArea, linkArea,<a name="line.2577"></a>
  2586. <span class="sourceLineNo">2578</span> state);<a name="line.2578"></a>
  2587. <span class="sourceLineNo">2579</span> }<a name="line.2579"></a>
  2588. <span class="sourceLineNo">2580</span> else {<a name="line.2580"></a>
  2589. <span class="sourceLineNo">2581</span> drawLabels(g2, keys, totalValue, plotArea, linkArea, state);<a name="line.2581"></a>
  2590. <span class="sourceLineNo">2582</span> }<a name="line.2582"></a>
  2591. <span class="sourceLineNo">2583</span><a name="line.2583"></a>
  2592. <span class="sourceLineNo">2584</span> }<a name="line.2584"></a>
  2593. <span class="sourceLineNo">2585</span> else {<a name="line.2585"></a>
  2594. <span class="sourceLineNo">2586</span> drawNoDataMessage(g2, plotArea);<a name="line.2586"></a>
  2595. <span class="sourceLineNo">2587</span> }<a name="line.2587"></a>
  2596. <span class="sourceLineNo">2588</span> }<a name="line.2588"></a>
  2597. <span class="sourceLineNo">2589</span><a name="line.2589"></a>
  2598. <span class="sourceLineNo">2590</span> /**<a name="line.2590"></a>
  2599. <span class="sourceLineNo">2591</span> * Draws a single data item.<a name="line.2591"></a>
  2600. <span class="sourceLineNo">2592</span> *<a name="line.2592"></a>
  2601. <span class="sourceLineNo">2593</span> * @param g2 the graphics device (&lt;code&gt;null&lt;/code&gt; not permitted).<a name="line.2593"></a>
  2602. <span class="sourceLineNo">2594</span> * @param section the section index.<a name="line.2594"></a>
  2603. <span class="sourceLineNo">2595</span> * @param dataArea the data plot area.<a name="line.2595"></a>
  2604. <span class="sourceLineNo">2596</span> * @param state state information for one chart.<a name="line.2596"></a>
  2605. <span class="sourceLineNo">2597</span> * @param currentPass the current pass index.<a name="line.2597"></a>
  2606. <span class="sourceLineNo">2598</span> */<a name="line.2598"></a>
  2607. <span class="sourceLineNo">2599</span> protected void drawItem(Graphics2D g2, int section, Rectangle2D dataArea,<a name="line.2599"></a>
  2608. <span class="sourceLineNo">2600</span> PiePlotState state, int currentPass) {<a name="line.2600"></a>
  2609. <span class="sourceLineNo">2601</span><a name="line.2601"></a>
  2610. <span class="sourceLineNo">2602</span> Number n = this.dataset.getValue(section);<a name="line.2602"></a>
  2611. <span class="sourceLineNo">2603</span> if (n == null) {<a name="line.2603"></a>
  2612. <span class="sourceLineNo">2604</span> return;<a name="line.2604"></a>
  2613. <span class="sourceLineNo">2605</span> }<a name="line.2605"></a>
  2614. <span class="sourceLineNo">2606</span> double value = n.doubleValue();<a name="line.2606"></a>
  2615. <span class="sourceLineNo">2607</span> double angle1 = 0.0;<a name="line.2607"></a>
  2616. <span class="sourceLineNo">2608</span> double angle2 = 0.0;<a name="line.2608"></a>
  2617. <span class="sourceLineNo">2609</span><a name="line.2609"></a>
  2618. <span class="sourceLineNo">2610</span> if (this.direction == Rotation.CLOCKWISE) {<a name="line.2610"></a>
  2619. <span class="sourceLineNo">2611</span> angle1 = state.getLatestAngle();<a name="line.2611"></a>
  2620. <span class="sourceLineNo">2612</span> angle2 = angle1 - value / state.getTotal() * 360.0;<a name="line.2612"></a>
  2621. <span class="sourceLineNo">2613</span> }<a name="line.2613"></a>
  2622. <span class="sourceLineNo">2614</span> else if (this.direction == Rotation.ANTICLOCKWISE) {<a name="line.2614"></a>
  2623. <span class="sourceLineNo">2615</span> angle1 = state.getLatestAngle();<a name="line.2615"></a>
  2624. <span class="sourceLineNo">2616</span> angle2 = angle1 + value / state.getTotal() * 360.0;<a name="line.2616"></a>
  2625. <span class="sourceLineNo">2617</span> }<a name="line.2617"></a>
  2626. <span class="sourceLineNo">2618</span> else {<a name="line.2618"></a>
  2627. <span class="sourceLineNo">2619</span> throw new IllegalStateException("Rotation type not recognised.");<a name="line.2619"></a>
  2628. <span class="sourceLineNo">2620</span> }<a name="line.2620"></a>
  2629. <span class="sourceLineNo">2621</span><a name="line.2621"></a>
  2630. <span class="sourceLineNo">2622</span> double angle = (angle2 - angle1);<a name="line.2622"></a>
  2631. <span class="sourceLineNo">2623</span> if (Math.abs(angle) &gt; getMinimumArcAngleToDraw()) {<a name="line.2623"></a>
  2632. <span class="sourceLineNo">2624</span> double ep = 0.0;<a name="line.2624"></a>
  2633. <span class="sourceLineNo">2625</span> double mep = getMaximumExplodePercent();<a name="line.2625"></a>
  2634. <span class="sourceLineNo">2626</span> if (mep &gt; 0.0) {<a name="line.2626"></a>
  2635. <span class="sourceLineNo">2627</span> ep = getExplodePercent(section) / mep;<a name="line.2627"></a>
  2636. <span class="sourceLineNo">2628</span> }<a name="line.2628"></a>
  2637. <span class="sourceLineNo">2629</span> Rectangle2D arcBounds = getArcBounds(state.getPieArea(),<a name="line.2629"></a>
  2638. <span class="sourceLineNo">2630</span> state.getExplodedPieArea(), angle1, angle, ep);<a name="line.2630"></a>
  2639. <span class="sourceLineNo">2631</span> Arc2D.Double arc = new Arc2D.Double(arcBounds, angle1, angle,<a name="line.2631"></a>
  2640. <span class="sourceLineNo">2632</span> Arc2D.PIE);<a name="line.2632"></a>
  2641. <span class="sourceLineNo">2633</span><a name="line.2633"></a>
  2642. <span class="sourceLineNo">2634</span> if (currentPass == 0) {<a name="line.2634"></a>
  2643. <span class="sourceLineNo">2635</span> if (this.shadowPaint != null &amp;&amp; this.shadowGenerator == null) {<a name="line.2635"></a>
  2644. <span class="sourceLineNo">2636</span> Shape shadowArc = ShapeUtilities.createTranslatedShape(<a name="line.2636"></a>
  2645. <span class="sourceLineNo">2637</span> arc, (float) this.shadowXOffset,<a name="line.2637"></a>
  2646. <span class="sourceLineNo">2638</span> (float) this.shadowYOffset);<a name="line.2638"></a>
  2647. <span class="sourceLineNo">2639</span> g2.setPaint(this.shadowPaint);<a name="line.2639"></a>
  2648. <span class="sourceLineNo">2640</span> g2.fill(shadowArc);<a name="line.2640"></a>
  2649. <span class="sourceLineNo">2641</span> }<a name="line.2641"></a>
  2650. <span class="sourceLineNo">2642</span> }<a name="line.2642"></a>
  2651. <span class="sourceLineNo">2643</span> else if (currentPass == 1) {<a name="line.2643"></a>
  2652. <span class="sourceLineNo">2644</span> Comparable key = getSectionKey(section);<a name="line.2644"></a>
  2653. <span class="sourceLineNo">2645</span> Paint paint = lookupSectionPaint(key, state);<a name="line.2645"></a>
  2654. <span class="sourceLineNo">2646</span> g2.setPaint(paint);<a name="line.2646"></a>
  2655. <span class="sourceLineNo">2647</span> g2.fill(arc);<a name="line.2647"></a>
  2656. <span class="sourceLineNo">2648</span><a name="line.2648"></a>
  2657. <span class="sourceLineNo">2649</span> Paint outlinePaint = lookupSectionOutlinePaint(key);<a name="line.2649"></a>
  2658. <span class="sourceLineNo">2650</span> Stroke outlineStroke = lookupSectionOutlineStroke(key);<a name="line.2650"></a>
  2659. <span class="sourceLineNo">2651</span> if (this.sectionOutlinesVisible) {<a name="line.2651"></a>
  2660. <span class="sourceLineNo">2652</span> g2.setPaint(outlinePaint);<a name="line.2652"></a>
  2661. <span class="sourceLineNo">2653</span> g2.setStroke(outlineStroke);<a name="line.2653"></a>
  2662. <span class="sourceLineNo">2654</span> g2.draw(arc);<a name="line.2654"></a>
  2663. <span class="sourceLineNo">2655</span> }<a name="line.2655"></a>
  2664. <span class="sourceLineNo">2656</span><a name="line.2656"></a>
  2665. <span class="sourceLineNo">2657</span> // update the linking line target for later<a name="line.2657"></a>
  2666. <span class="sourceLineNo">2658</span> // add an entity for the pie section<a name="line.2658"></a>
  2667. <span class="sourceLineNo">2659</span> if (state.getInfo() != null) {<a name="line.2659"></a>
  2668. <span class="sourceLineNo">2660</span> EntityCollection entities = state.getEntityCollection();<a name="line.2660"></a>
  2669. <span class="sourceLineNo">2661</span> if (entities != null) {<a name="line.2661"></a>
  2670. <span class="sourceLineNo">2662</span> String tip = null;<a name="line.2662"></a>
  2671. <span class="sourceLineNo">2663</span> if (this.toolTipGenerator != null) {<a name="line.2663"></a>
  2672. <span class="sourceLineNo">2664</span> tip = this.toolTipGenerator.generateToolTip(<a name="line.2664"></a>
  2673. <span class="sourceLineNo">2665</span> this.dataset, key);<a name="line.2665"></a>
  2674. <span class="sourceLineNo">2666</span> }<a name="line.2666"></a>
  2675. <span class="sourceLineNo">2667</span> String url = null;<a name="line.2667"></a>
  2676. <span class="sourceLineNo">2668</span> if (this.urlGenerator != null) {<a name="line.2668"></a>
  2677. <span class="sourceLineNo">2669</span> url = this.urlGenerator.generateURL(this.dataset,<a name="line.2669"></a>
  2678. <span class="sourceLineNo">2670</span> key, this.pieIndex);<a name="line.2670"></a>
  2679. <span class="sourceLineNo">2671</span> }<a name="line.2671"></a>
  2680. <span class="sourceLineNo">2672</span> PieSectionEntity entity = new PieSectionEntity(<a name="line.2672"></a>
  2681. <span class="sourceLineNo">2673</span> arc, this.dataset, this.pieIndex, section, key,<a name="line.2673"></a>
  2682. <span class="sourceLineNo">2674</span> tip, url);<a name="line.2674"></a>
  2683. <span class="sourceLineNo">2675</span> entities.add(entity);<a name="line.2675"></a>
  2684. <span class="sourceLineNo">2676</span> }<a name="line.2676"></a>
  2685. <span class="sourceLineNo">2677</span> }<a name="line.2677"></a>
  2686. <span class="sourceLineNo">2678</span> }<a name="line.2678"></a>
  2687. <span class="sourceLineNo">2679</span> }<a name="line.2679"></a>
  2688. <span class="sourceLineNo">2680</span> state.setLatestAngle(angle2);<a name="line.2680"></a>
  2689. <span class="sourceLineNo">2681</span> }<a name="line.2681"></a>
  2690. <span class="sourceLineNo">2682</span><a name="line.2682"></a>
  2691. <span class="sourceLineNo">2683</span> /**<a name="line.2683"></a>
  2692. <span class="sourceLineNo">2684</span> * Draws the pie section labels in the simple form.<a name="line.2684"></a>
  2693. <span class="sourceLineNo">2685</span> *<a name="line.2685"></a>
  2694. <span class="sourceLineNo">2686</span> * @param g2 the graphics device.<a name="line.2686"></a>
  2695. <span class="sourceLineNo">2687</span> * @param keys the section keys.<a name="line.2687"></a>
  2696. <span class="sourceLineNo">2688</span> * @param totalValue the total value for all sections in the pie.<a name="line.2688"></a>
  2697. <span class="sourceLineNo">2689</span> * @param plotArea the plot area.<a name="line.2689"></a>
  2698. <span class="sourceLineNo">2690</span> * @param pieArea the area containing the pie.<a name="line.2690"></a>
  2699. <span class="sourceLineNo">2691</span> * @param state the plot state.<a name="line.2691"></a>
  2700. <span class="sourceLineNo">2692</span> *<a name="line.2692"></a>
  2701. <span class="sourceLineNo">2693</span> * @since 1.0.7<a name="line.2693"></a>
  2702. <span class="sourceLineNo">2694</span> */<a name="line.2694"></a>
  2703. <span class="sourceLineNo">2695</span> protected void drawSimpleLabels(Graphics2D g2, List keys,<a name="line.2695"></a>
  2704. <span class="sourceLineNo">2696</span> double totalValue, Rectangle2D plotArea, Rectangle2D pieArea,<a name="line.2696"></a>
  2705. <span class="sourceLineNo">2697</span> PiePlotState state) {<a name="line.2697"></a>
  2706. <span class="sourceLineNo">2698</span><a name="line.2698"></a>
  2707. <span class="sourceLineNo">2699</span> Composite originalComposite = g2.getComposite();<a name="line.2699"></a>
  2708. <span class="sourceLineNo">2700</span> g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,<a name="line.2700"></a>
  2709. <span class="sourceLineNo">2701</span> 1.0f));<a name="line.2701"></a>
  2710. <span class="sourceLineNo">2702</span><a name="line.2702"></a>
  2711. <span class="sourceLineNo">2703</span> Rectangle2D labelsArea = this.simpleLabelOffset.createInsetRectangle(<a name="line.2703"></a>
  2712. <span class="sourceLineNo">2704</span> pieArea);<a name="line.2704"></a>
  2713. <span class="sourceLineNo">2705</span> double runningTotal = 0.0;<a name="line.2705"></a>
  2714. <span class="sourceLineNo">2706</span> Iterator iterator = keys.iterator();<a name="line.2706"></a>
  2715. <span class="sourceLineNo">2707</span> while (iterator.hasNext()) {<a name="line.2707"></a>
  2716. <span class="sourceLineNo">2708</span> Comparable key = (Comparable) iterator.next();<a name="line.2708"></a>
  2717. <span class="sourceLineNo">2709</span> boolean include;<a name="line.2709"></a>
  2718. <span class="sourceLineNo">2710</span> double v = 0.0;<a name="line.2710"></a>
  2719. <span class="sourceLineNo">2711</span> Number n = getDataset().getValue(key);<a name="line.2711"></a>
  2720. <span class="sourceLineNo">2712</span> if (n == null) {<a name="line.2712"></a>
  2721. <span class="sourceLineNo">2713</span> include = !getIgnoreNullValues();<a name="line.2713"></a>
  2722. <span class="sourceLineNo">2714</span> }<a name="line.2714"></a>
  2723. <span class="sourceLineNo">2715</span> else {<a name="line.2715"></a>
  2724. <span class="sourceLineNo">2716</span> v = n.doubleValue();<a name="line.2716"></a>
  2725. <span class="sourceLineNo">2717</span> include = getIgnoreZeroValues() ? v &gt; 0.0 : v &gt;= 0.0;<a name="line.2717"></a>
  2726. <span class="sourceLineNo">2718</span> }<a name="line.2718"></a>
  2727. <span class="sourceLineNo">2719</span><a name="line.2719"></a>
  2728. <span class="sourceLineNo">2720</span> if (include) {<a name="line.2720"></a>
  2729. <span class="sourceLineNo">2721</span> runningTotal = runningTotal + v;<a name="line.2721"></a>
  2730. <span class="sourceLineNo">2722</span> // work out the mid angle (0 - 90 and 270 - 360) = right,<a name="line.2722"></a>
  2731. <span class="sourceLineNo">2723</span> // otherwise left<a name="line.2723"></a>
  2732. <span class="sourceLineNo">2724</span> double mid = getStartAngle() + (getDirection().getFactor()<a name="line.2724"></a>
  2733. <span class="sourceLineNo">2725</span> * ((runningTotal - v / 2.0) * 360) / totalValue);<a name="line.2725"></a>
  2734. <span class="sourceLineNo">2726</span><a name="line.2726"></a>
  2735. <span class="sourceLineNo">2727</span> Arc2D arc = new Arc2D.Double(labelsArea, getStartAngle(),<a name="line.2727"></a>
  2736. <span class="sourceLineNo">2728</span> mid - getStartAngle(), Arc2D.OPEN);<a name="line.2728"></a>
  2737. <span class="sourceLineNo">2729</span> int x = (int) arc.getEndPoint().getX();<a name="line.2729"></a>
  2738. <span class="sourceLineNo">2730</span> int y = (int) arc.getEndPoint().getY();<a name="line.2730"></a>
  2739. <span class="sourceLineNo">2731</span><a name="line.2731"></a>
  2740. <span class="sourceLineNo">2732</span> PieSectionLabelGenerator myLabelGenerator = getLabelGenerator();<a name="line.2732"></a>
  2741. <span class="sourceLineNo">2733</span> if (myLabelGenerator == null) {<a name="line.2733"></a>
  2742. <span class="sourceLineNo">2734</span> continue;<a name="line.2734"></a>
  2743. <span class="sourceLineNo">2735</span> }<a name="line.2735"></a>
  2744. <span class="sourceLineNo">2736</span> String label = myLabelGenerator.generateSectionLabel(<a name="line.2736"></a>
  2745. <span class="sourceLineNo">2737</span> this.dataset, key);<a name="line.2737"></a>
  2746. <span class="sourceLineNo">2738</span> if (label == null) {<a name="line.2738"></a>
  2747. <span class="sourceLineNo">2739</span> continue;<a name="line.2739"></a>
  2748. <span class="sourceLineNo">2740</span> }<a name="line.2740"></a>
  2749. <span class="sourceLineNo">2741</span> g2.setFont(this.labelFont);<a name="line.2741"></a>
  2750. <span class="sourceLineNo">2742</span> FontMetrics fm = g2.getFontMetrics();<a name="line.2742"></a>
  2751. <span class="sourceLineNo">2743</span> Rectangle2D bounds = TextUtilities.getTextBounds(label, g2, fm);<a name="line.2743"></a>
  2752. <span class="sourceLineNo">2744</span> Rectangle2D out = this.labelPadding.createOutsetRectangle(<a name="line.2744"></a>
  2753. <span class="sourceLineNo">2745</span> bounds);<a name="line.2745"></a>
  2754. <span class="sourceLineNo">2746</span> Shape bg = ShapeUtilities.createTranslatedShape(out,<a name="line.2746"></a>
  2755. <span class="sourceLineNo">2747</span> x - bounds.getCenterX(), y - bounds.getCenterY());<a name="line.2747"></a>
  2756. <span class="sourceLineNo">2748</span> if (this.labelShadowPaint != null<a name="line.2748"></a>
  2757. <span class="sourceLineNo">2749</span> &amp;&amp; this.shadowGenerator == null) {<a name="line.2749"></a>
  2758. <span class="sourceLineNo">2750</span> Shape shadow = ShapeUtilities.createTranslatedShape(bg,<a name="line.2750"></a>
  2759. <span class="sourceLineNo">2751</span> this.shadowXOffset, this.shadowYOffset);<a name="line.2751"></a>
  2760. <span class="sourceLineNo">2752</span> g2.setPaint(this.labelShadowPaint);<a name="line.2752"></a>
  2761. <span class="sourceLineNo">2753</span> g2.fill(shadow);<a name="line.2753"></a>
  2762. <span class="sourceLineNo">2754</span> }<a name="line.2754"></a>
  2763. <span class="sourceLineNo">2755</span> if (this.labelBackgroundPaint != null) {<a name="line.2755"></a>
  2764. <span class="sourceLineNo">2756</span> g2.setPaint(this.labelBackgroundPaint);<a name="line.2756"></a>
  2765. <span class="sourceLineNo">2757</span> g2.fill(bg);<a name="line.2757"></a>
  2766. <span class="sourceLineNo">2758</span> }<a name="line.2758"></a>
  2767. <span class="sourceLineNo">2759</span> if (this.labelOutlinePaint != null<a name="line.2759"></a>
  2768. <span class="sourceLineNo">2760</span> &amp;&amp; this.labelOutlineStroke != null) {<a name="line.2760"></a>
  2769. <span class="sourceLineNo">2761</span> g2.setPaint(this.labelOutlinePaint);<a name="line.2761"></a>
  2770. <span class="sourceLineNo">2762</span> g2.setStroke(this.labelOutlineStroke);<a name="line.2762"></a>
  2771. <span class="sourceLineNo">2763</span> g2.draw(bg);<a name="line.2763"></a>
  2772. <span class="sourceLineNo">2764</span> }<a name="line.2764"></a>
  2773. <span class="sourceLineNo">2765</span><a name="line.2765"></a>
  2774. <span class="sourceLineNo">2766</span> g2.setPaint(this.labelPaint);<a name="line.2766"></a>
  2775. <span class="sourceLineNo">2767</span> g2.setFont(this.labelFont);<a name="line.2767"></a>
  2776. <span class="sourceLineNo">2768</span> TextUtilities.drawAlignedString(label, g2, x, y,<a name="line.2768"></a>
  2777. <span class="sourceLineNo">2769</span> TextAnchor.CENTER);<a name="line.2769"></a>
  2778. <span class="sourceLineNo">2770</span><a name="line.2770"></a>
  2779. <span class="sourceLineNo">2771</span> }<a name="line.2771"></a>
  2780. <span class="sourceLineNo">2772</span> }<a name="line.2772"></a>
  2781. <span class="sourceLineNo">2773</span><a name="line.2773"></a>
  2782. <span class="sourceLineNo">2774</span> g2.setComposite(originalComposite);<a name="line.2774"></a>
  2783. <span class="sourceLineNo">2775</span><a name="line.2775"></a>
  2784. <span class="sourceLineNo">2776</span> }<a name="line.2776"></a>
  2785. <span class="sourceLineNo">2777</span><a name="line.2777"></a>
  2786. <span class="sourceLineNo">2778</span> /**<a name="line.2778"></a>
  2787. <span class="sourceLineNo">2779</span> * Draws the labels for the pie sections.<a name="line.2779"></a>
  2788. <span class="sourceLineNo">2780</span> *<a name="line.2780"></a>
  2789. <span class="sourceLineNo">2781</span> * @param g2 the graphics device.<a name="line.2781"></a>
  2790. <span class="sourceLineNo">2782</span> * @param keys the keys.<a name="line.2782"></a>
  2791. <span class="sourceLineNo">2783</span> * @param totalValue the total value.<a name="line.2783"></a>
  2792. <span class="sourceLineNo">2784</span> * @param plotArea the plot area.<a name="line.2784"></a>
  2793. <span class="sourceLineNo">2785</span> * @param linkArea the link area.<a name="line.2785"></a>
  2794. <span class="sourceLineNo">2786</span> * @param state the state.<a name="line.2786"></a>
  2795. <span class="sourceLineNo">2787</span> */<a name="line.2787"></a>
  2796. <span class="sourceLineNo">2788</span> protected void drawLabels(Graphics2D g2, List keys, double totalValue,<a name="line.2788"></a>
  2797. <span class="sourceLineNo">2789</span> Rectangle2D plotArea, Rectangle2D linkArea,<a name="line.2789"></a>
  2798. <span class="sourceLineNo">2790</span> PiePlotState state) {<a name="line.2790"></a>
  2799. <span class="sourceLineNo">2791</span><a name="line.2791"></a>
  2800. <span class="sourceLineNo">2792</span> Composite originalComposite = g2.getComposite();<a name="line.2792"></a>
  2801. <span class="sourceLineNo">2793</span> g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,<a name="line.2793"></a>
  2802. <span class="sourceLineNo">2794</span> 1.0f));<a name="line.2794"></a>
  2803. <span class="sourceLineNo">2795</span><a name="line.2795"></a>
  2804. <span class="sourceLineNo">2796</span> // classify the keys according to which side the label will appear...<a name="line.2796"></a>
  2805. <span class="sourceLineNo">2797</span> DefaultKeyedValues leftKeys = new DefaultKeyedValues();<a name="line.2797"></a>
  2806. <span class="sourceLineNo">2798</span> DefaultKeyedValues rightKeys = new DefaultKeyedValues();<a name="line.2798"></a>
  2807. <span class="sourceLineNo">2799</span><a name="line.2799"></a>
  2808. <span class="sourceLineNo">2800</span> double runningTotal = 0.0;<a name="line.2800"></a>
  2809. <span class="sourceLineNo">2801</span> Iterator iterator = keys.iterator();<a name="line.2801"></a>
  2810. <span class="sourceLineNo">2802</span> while (iterator.hasNext()) {<a name="line.2802"></a>
  2811. <span class="sourceLineNo">2803</span> Comparable key = (Comparable) iterator.next();<a name="line.2803"></a>
  2812. <span class="sourceLineNo">2804</span> boolean include;<a name="line.2804"></a>
  2813. <span class="sourceLineNo">2805</span> double v = 0.0;<a name="line.2805"></a>
  2814. <span class="sourceLineNo">2806</span> Number n = this.dataset.getValue(key);<a name="line.2806"></a>
  2815. <span class="sourceLineNo">2807</span> if (n == null) {<a name="line.2807"></a>
  2816. <span class="sourceLineNo">2808</span> include = !this.ignoreNullValues;<a name="line.2808"></a>
  2817. <span class="sourceLineNo">2809</span> }<a name="line.2809"></a>
  2818. <span class="sourceLineNo">2810</span> else {<a name="line.2810"></a>
  2819. <span class="sourceLineNo">2811</span> v = n.doubleValue();<a name="line.2811"></a>
  2820. <span class="sourceLineNo">2812</span> include = this.ignoreZeroValues ? v &gt; 0.0 : v &gt;= 0.0;<a name="line.2812"></a>
  2821. <span class="sourceLineNo">2813</span> }<a name="line.2813"></a>
  2822. <span class="sourceLineNo">2814</span><a name="line.2814"></a>
  2823. <span class="sourceLineNo">2815</span> if (include) {<a name="line.2815"></a>
  2824. <span class="sourceLineNo">2816</span> runningTotal = runningTotal + v;<a name="line.2816"></a>
  2825. <span class="sourceLineNo">2817</span> // work out the mid angle (0 - 90 and 270 - 360) = right,<a name="line.2817"></a>
  2826. <span class="sourceLineNo">2818</span> // otherwise left<a name="line.2818"></a>
  2827. <span class="sourceLineNo">2819</span> double mid = this.startAngle + (this.direction.getFactor()<a name="line.2819"></a>
  2828. <span class="sourceLineNo">2820</span> * ((runningTotal - v / 2.0) * 360) / totalValue);<a name="line.2820"></a>
  2829. <span class="sourceLineNo">2821</span> if (Math.cos(Math.toRadians(mid)) &lt; 0.0) {<a name="line.2821"></a>
  2830. <span class="sourceLineNo">2822</span> leftKeys.addValue(key, new Double(mid));<a name="line.2822"></a>
  2831. <span class="sourceLineNo">2823</span> }<a name="line.2823"></a>
  2832. <span class="sourceLineNo">2824</span> else {<a name="line.2824"></a>
  2833. <span class="sourceLineNo">2825</span> rightKeys.addValue(key, new Double(mid));<a name="line.2825"></a>
  2834. <span class="sourceLineNo">2826</span> }<a name="line.2826"></a>
  2835. <span class="sourceLineNo">2827</span> }<a name="line.2827"></a>
  2836. <span class="sourceLineNo">2828</span> }<a name="line.2828"></a>
  2837. <span class="sourceLineNo">2829</span><a name="line.2829"></a>
  2838. <span class="sourceLineNo">2830</span> g2.setFont(getLabelFont());<a name="line.2830"></a>
  2839. <span class="sourceLineNo">2831</span><a name="line.2831"></a>
  2840. <span class="sourceLineNo">2832</span> // calculate the max label width from the plot dimensions, because<a name="line.2832"></a>
  2841. <span class="sourceLineNo">2833</span> // a circular pie can leave a lot more room for labels...<a name="line.2833"></a>
  2842. <span class="sourceLineNo">2834</span> double marginX = plotArea.getX();<a name="line.2834"></a>
  2843. <span class="sourceLineNo">2835</span> double gap = plotArea.getWidth() * this.labelGap;<a name="line.2835"></a>
  2844. <span class="sourceLineNo">2836</span> double ww = linkArea.getX() - gap - marginX;<a name="line.2836"></a>
  2845. <span class="sourceLineNo">2837</span> float labelWidth = (float) this.labelPadding.trimWidth(ww);<a name="line.2837"></a>
  2846. <span class="sourceLineNo">2838</span><a name="line.2838"></a>
  2847. <span class="sourceLineNo">2839</span> // draw the labels...<a name="line.2839"></a>
  2848. <span class="sourceLineNo">2840</span> if (this.labelGenerator != null) {<a name="line.2840"></a>
  2849. <span class="sourceLineNo">2841</span> drawLeftLabels(leftKeys, g2, plotArea, linkArea, labelWidth,<a name="line.2841"></a>
  2850. <span class="sourceLineNo">2842</span> state);<a name="line.2842"></a>
  2851. <span class="sourceLineNo">2843</span> drawRightLabels(rightKeys, g2, plotArea, linkArea, labelWidth,<a name="line.2843"></a>
  2852. <span class="sourceLineNo">2844</span> state);<a name="line.2844"></a>
  2853. <span class="sourceLineNo">2845</span> }<a name="line.2845"></a>
  2854. <span class="sourceLineNo">2846</span> g2.setComposite(originalComposite);<a name="line.2846"></a>
  2855. <span class="sourceLineNo">2847</span><a name="line.2847"></a>
  2856. <span class="sourceLineNo">2848</span> }<a name="line.2848"></a>
  2857. <span class="sourceLineNo">2849</span><a name="line.2849"></a>
  2858. <span class="sourceLineNo">2850</span> /**<a name="line.2850"></a>
  2859. <span class="sourceLineNo">2851</span> * Draws the left labels.<a name="line.2851"></a>
  2860. <span class="sourceLineNo">2852</span> *<a name="line.2852"></a>
  2861. <span class="sourceLineNo">2853</span> * @param leftKeys a collection of keys and angles (to the middle of the<a name="line.2853"></a>
  2862. <span class="sourceLineNo">2854</span> * section, in degrees) for the sections on the left side of the<a name="line.2854"></a>
  2863. <span class="sourceLineNo">2855</span> * plot.<a name="line.2855"></a>
  2864. <span class="sourceLineNo">2856</span> * @param g2 the graphics device.<a name="line.2856"></a>
  2865. <span class="sourceLineNo">2857</span> * @param plotArea the plot area.<a name="line.2857"></a>
  2866. <span class="sourceLineNo">2858</span> * @param linkArea the link area.<a name="line.2858"></a>
  2867. <span class="sourceLineNo">2859</span> * @param maxLabelWidth the maximum label width.<a name="line.2859"></a>
  2868. <span class="sourceLineNo">2860</span> * @param state the state.<a name="line.2860"></a>
  2869. <span class="sourceLineNo">2861</span> */<a name="line.2861"></a>
  2870. <span class="sourceLineNo">2862</span> protected void drawLeftLabels(KeyedValues leftKeys, Graphics2D g2,<a name="line.2862"></a>
  2871. <span class="sourceLineNo">2863</span> Rectangle2D plotArea, Rectangle2D linkArea,<a name="line.2863"></a>
  2872. <span class="sourceLineNo">2864</span> float maxLabelWidth, PiePlotState state) {<a name="line.2864"></a>
  2873. <span class="sourceLineNo">2865</span><a name="line.2865"></a>
  2874. <span class="sourceLineNo">2866</span> this.labelDistributor.clear();<a name="line.2866"></a>
  2875. <span class="sourceLineNo">2867</span> double lGap = plotArea.getWidth() * this.labelGap;<a name="line.2867"></a>
  2876. <span class="sourceLineNo">2868</span> double verticalLinkRadius = state.getLinkArea().getHeight() / 2.0;<a name="line.2868"></a>
  2877. <span class="sourceLineNo">2869</span> for (int i = 0; i &lt; leftKeys.getItemCount(); i++) {<a name="line.2869"></a>
  2878. <span class="sourceLineNo">2870</span> String label = this.labelGenerator.generateSectionLabel(<a name="line.2870"></a>
  2879. <span class="sourceLineNo">2871</span> this.dataset, leftKeys.getKey(i));<a name="line.2871"></a>
  2880. <span class="sourceLineNo">2872</span> if (label != null) {<a name="line.2872"></a>
  2881. <span class="sourceLineNo">2873</span> TextBlock block = TextUtilities.createTextBlock(label,<a name="line.2873"></a>
  2882. <span class="sourceLineNo">2874</span> this.labelFont, this.labelPaint, maxLabelWidth,<a name="line.2874"></a>
  2883. <span class="sourceLineNo">2875</span> new G2TextMeasurer(g2));<a name="line.2875"></a>
  2884. <span class="sourceLineNo">2876</span> TextBox labelBox = new TextBox(block);<a name="line.2876"></a>
  2885. <span class="sourceLineNo">2877</span> labelBox.setBackgroundPaint(this.labelBackgroundPaint);<a name="line.2877"></a>
  2886. <span class="sourceLineNo">2878</span> labelBox.setOutlinePaint(this.labelOutlinePaint);<a name="line.2878"></a>
  2887. <span class="sourceLineNo">2879</span> labelBox.setOutlineStroke(this.labelOutlineStroke);<a name="line.2879"></a>
  2888. <span class="sourceLineNo">2880</span> if (this.shadowGenerator == null) {<a name="line.2880"></a>
  2889. <span class="sourceLineNo">2881</span> labelBox.setShadowPaint(this.labelShadowPaint);<a name="line.2881"></a>
  2890. <span class="sourceLineNo">2882</span> }<a name="line.2882"></a>
  2891. <span class="sourceLineNo">2883</span> else {<a name="line.2883"></a>
  2892. <span class="sourceLineNo">2884</span> labelBox.setShadowPaint(null);<a name="line.2884"></a>
  2893. <span class="sourceLineNo">2885</span> }<a name="line.2885"></a>
  2894. <span class="sourceLineNo">2886</span> labelBox.setInteriorGap(this.labelPadding);<a name="line.2886"></a>
  2895. <span class="sourceLineNo">2887</span> double theta = Math.toRadians(<a name="line.2887"></a>
  2896. <span class="sourceLineNo">2888</span> leftKeys.getValue(i).doubleValue());<a name="line.2888"></a>
  2897. <span class="sourceLineNo">2889</span> double baseY = state.getPieCenterY() - Math.sin(theta)<a name="line.2889"></a>
  2898. <span class="sourceLineNo">2890</span> * verticalLinkRadius;<a name="line.2890"></a>
  2899. <span class="sourceLineNo">2891</span> double hh = labelBox.getHeight(g2);<a name="line.2891"></a>
  2900. <span class="sourceLineNo">2892</span><a name="line.2892"></a>
  2901. <span class="sourceLineNo">2893</span> this.labelDistributor.addPieLabelRecord(new PieLabelRecord(<a name="line.2893"></a>
  2902. <span class="sourceLineNo">2894</span> leftKeys.getKey(i), theta, baseY, labelBox, hh,<a name="line.2894"></a>
  2903. <span class="sourceLineNo">2895</span> lGap / 2.0 + lGap / 2.0 * -Math.cos(theta), 1.0<a name="line.2895"></a>
  2904. <span class="sourceLineNo">2896</span> - getLabelLinkDepth()<a name="line.2896"></a>
  2905. <span class="sourceLineNo">2897</span> + getExplodePercent(leftKeys.getKey(i))));<a name="line.2897"></a>
  2906. <span class="sourceLineNo">2898</span> }<a name="line.2898"></a>
  2907. <span class="sourceLineNo">2899</span> }<a name="line.2899"></a>
  2908. <span class="sourceLineNo">2900</span> double hh = plotArea.getHeight();<a name="line.2900"></a>
  2909. <span class="sourceLineNo">2901</span> double gap = hh * getInteriorGap();<a name="line.2901"></a>
  2910. <span class="sourceLineNo">2902</span> this.labelDistributor.distributeLabels(plotArea.getMinY() + gap,<a name="line.2902"></a>
  2911. <span class="sourceLineNo">2903</span> hh - 2 * gap);<a name="line.2903"></a>
  2912. <span class="sourceLineNo">2904</span> for (int i = 0; i &lt; this.labelDistributor.getItemCount(); i++) {<a name="line.2904"></a>
  2913. <span class="sourceLineNo">2905</span> drawLeftLabel(g2, state,<a name="line.2905"></a>
  2914. <span class="sourceLineNo">2906</span> this.labelDistributor.getPieLabelRecord(i));<a name="line.2906"></a>
  2915. <span class="sourceLineNo">2907</span> }<a name="line.2907"></a>
  2916. <span class="sourceLineNo">2908</span> }<a name="line.2908"></a>
  2917. <span class="sourceLineNo">2909</span><a name="line.2909"></a>
  2918. <span class="sourceLineNo">2910</span> /**<a name="line.2910"></a>
  2919. <span class="sourceLineNo">2911</span> * Draws the right labels.<a name="line.2911"></a>
  2920. <span class="sourceLineNo">2912</span> *<a name="line.2912"></a>
  2921. <span class="sourceLineNo">2913</span> * @param keys the keys.<a name="line.2913"></a>
  2922. <span class="sourceLineNo">2914</span> * @param g2 the graphics device.<a name="line.2914"></a>
  2923. <span class="sourceLineNo">2915</span> * @param plotArea the plot area.<a name="line.2915"></a>
  2924. <span class="sourceLineNo">2916</span> * @param linkArea the link area.<a name="line.2916"></a>
  2925. <span class="sourceLineNo">2917</span> * @param maxLabelWidth the maximum label width.<a name="line.2917"></a>
  2926. <span class="sourceLineNo">2918</span> * @param state the state.<a name="line.2918"></a>
  2927. <span class="sourceLineNo">2919</span> */<a name="line.2919"></a>
  2928. <span class="sourceLineNo">2920</span> protected void drawRightLabels(KeyedValues keys, Graphics2D g2,<a name="line.2920"></a>
  2929. <span class="sourceLineNo">2921</span> Rectangle2D plotArea, Rectangle2D linkArea,<a name="line.2921"></a>
  2930. <span class="sourceLineNo">2922</span> float maxLabelWidth, PiePlotState state) {<a name="line.2922"></a>
  2931. <span class="sourceLineNo">2923</span><a name="line.2923"></a>
  2932. <span class="sourceLineNo">2924</span> // draw the right labels...<a name="line.2924"></a>
  2933. <span class="sourceLineNo">2925</span> this.labelDistributor.clear();<a name="line.2925"></a>
  2934. <span class="sourceLineNo">2926</span> double lGap = plotArea.getWidth() * this.labelGap;<a name="line.2926"></a>
  2935. <span class="sourceLineNo">2927</span> double verticalLinkRadius = state.getLinkArea().getHeight() / 2.0;<a name="line.2927"></a>
  2936. <span class="sourceLineNo">2928</span><a name="line.2928"></a>
  2937. <span class="sourceLineNo">2929</span> for (int i = 0; i &lt; keys.getItemCount(); i++) {<a name="line.2929"></a>
  2938. <span class="sourceLineNo">2930</span> String label = this.labelGenerator.generateSectionLabel(<a name="line.2930"></a>
  2939. <span class="sourceLineNo">2931</span> this.dataset, keys.getKey(i));<a name="line.2931"></a>
  2940. <span class="sourceLineNo">2932</span><a name="line.2932"></a>
  2941. <span class="sourceLineNo">2933</span> if (label != null) {<a name="line.2933"></a>
  2942. <span class="sourceLineNo">2934</span> TextBlock block = TextUtilities.createTextBlock(label,<a name="line.2934"></a>
  2943. <span class="sourceLineNo">2935</span> this.labelFont, this.labelPaint, maxLabelWidth,<a name="line.2935"></a>
  2944. <span class="sourceLineNo">2936</span> new G2TextMeasurer(g2));<a name="line.2936"></a>
  2945. <span class="sourceLineNo">2937</span> TextBox labelBox = new TextBox(block);<a name="line.2937"></a>
  2946. <span class="sourceLineNo">2938</span> labelBox.setBackgroundPaint(this.labelBackgroundPaint);<a name="line.2938"></a>
  2947. <span class="sourceLineNo">2939</span> labelBox.setOutlinePaint(this.labelOutlinePaint);<a name="line.2939"></a>
  2948. <span class="sourceLineNo">2940</span> labelBox.setOutlineStroke(this.labelOutlineStroke);<a name="line.2940"></a>
  2949. <span class="sourceLineNo">2941</span> if (this.shadowGenerator == null) {<a name="line.2941"></a>
  2950. <span class="sourceLineNo">2942</span> labelBox.setShadowPaint(this.labelShadowPaint);<a name="line.2942"></a>
  2951. <span class="sourceLineNo">2943</span> }<a name="line.2943"></a>
  2952. <span class="sourceLineNo">2944</span> else {<a name="line.2944"></a>
  2953. <span class="sourceLineNo">2945</span> labelBox.setShadowPaint(null);<a name="line.2945"></a>
  2954. <span class="sourceLineNo">2946</span> }<a name="line.2946"></a>
  2955. <span class="sourceLineNo">2947</span> labelBox.setInteriorGap(this.labelPadding);<a name="line.2947"></a>
  2956. <span class="sourceLineNo">2948</span> double theta = Math.toRadians(keys.getValue(i).doubleValue());<a name="line.2948"></a>
  2957. <span class="sourceLineNo">2949</span> double baseY = state.getPieCenterY()<a name="line.2949"></a>
  2958. <span class="sourceLineNo">2950</span> - Math.sin(theta) * verticalLinkRadius;<a name="line.2950"></a>
  2959. <span class="sourceLineNo">2951</span> double hh = labelBox.getHeight(g2);<a name="line.2951"></a>
  2960. <span class="sourceLineNo">2952</span> this.labelDistributor.addPieLabelRecord(new PieLabelRecord(<a name="line.2952"></a>
  2961. <span class="sourceLineNo">2953</span> keys.getKey(i), theta, baseY, labelBox, hh,<a name="line.2953"></a>
  2962. <span class="sourceLineNo">2954</span> lGap / 2.0 + lGap / 2.0 * Math.cos(theta),<a name="line.2954"></a>
  2963. <span class="sourceLineNo">2955</span> 1.0 - getLabelLinkDepth()<a name="line.2955"></a>
  2964. <span class="sourceLineNo">2956</span> + getExplodePercent(keys.getKey(i))));<a name="line.2956"></a>
  2965. <span class="sourceLineNo">2957</span> }<a name="line.2957"></a>
  2966. <span class="sourceLineNo">2958</span> }<a name="line.2958"></a>
  2967. <span class="sourceLineNo">2959</span> double hh = plotArea.getHeight();<a name="line.2959"></a>
  2968. <span class="sourceLineNo">2960</span> double gap = 0.00; //hh * getInteriorGap();<a name="line.2960"></a>
  2969. <span class="sourceLineNo">2961</span> this.labelDistributor.distributeLabels(plotArea.getMinY() + gap,<a name="line.2961"></a>
  2970. <span class="sourceLineNo">2962</span> hh - 2 * gap);<a name="line.2962"></a>
  2971. <span class="sourceLineNo">2963</span> for (int i = 0; i &lt; this.labelDistributor.getItemCount(); i++) {<a name="line.2963"></a>
  2972. <span class="sourceLineNo">2964</span> drawRightLabel(g2, state,<a name="line.2964"></a>
  2973. <span class="sourceLineNo">2965</span> this.labelDistributor.getPieLabelRecord(i));<a name="line.2965"></a>
  2974. <span class="sourceLineNo">2966</span> }<a name="line.2966"></a>
  2975. <span class="sourceLineNo">2967</span><a name="line.2967"></a>
  2976. <span class="sourceLineNo">2968</span> }<a name="line.2968"></a>
  2977. <span class="sourceLineNo">2969</span><a name="line.2969"></a>
  2978. <span class="sourceLineNo">2970</span> /**<a name="line.2970"></a>
  2979. <span class="sourceLineNo">2971</span> * Returns a collection of legend items for the pie chart.<a name="line.2971"></a>
  2980. <span class="sourceLineNo">2972</span> *<a name="line.2972"></a>
  2981. <span class="sourceLineNo">2973</span> * @return The legend items (never &lt;code&gt;null&lt;/code&gt;).<a name="line.2973"></a>
  2982. <span class="sourceLineNo">2974</span> */<a name="line.2974"></a>
  2983. <span class="sourceLineNo">2975</span> @Override<a name="line.2975"></a>
  2984. <span class="sourceLineNo">2976</span> public LegendItemCollection getLegendItems() {<a name="line.2976"></a>
  2985. <span class="sourceLineNo">2977</span><a name="line.2977"></a>
  2986. <span class="sourceLineNo">2978</span> LegendItemCollection result = new LegendItemCollection();<a name="line.2978"></a>
  2987. <span class="sourceLineNo">2979</span> if (this.dataset == null) {<a name="line.2979"></a>
  2988. <span class="sourceLineNo">2980</span> return result;<a name="line.2980"></a>
  2989. <span class="sourceLineNo">2981</span> }<a name="line.2981"></a>
  2990. <span class="sourceLineNo">2982</span> List keys = this.dataset.getKeys();<a name="line.2982"></a>
  2991. <span class="sourceLineNo">2983</span> int section = 0;<a name="line.2983"></a>
  2992. <span class="sourceLineNo">2984</span> Shape shape = getLegendItemShape();<a name="line.2984"></a>
  2993. <span class="sourceLineNo">2985</span> Iterator iterator = keys.iterator();<a name="line.2985"></a>
  2994. <span class="sourceLineNo">2986</span> while (iterator.hasNext()) {<a name="line.2986"></a>
  2995. <span class="sourceLineNo">2987</span> Comparable key = (Comparable) iterator.next();<a name="line.2987"></a>
  2996. <span class="sourceLineNo">2988</span> Number n = this.dataset.getValue(key);<a name="line.2988"></a>
  2997. <span class="sourceLineNo">2989</span> boolean include;<a name="line.2989"></a>
  2998. <span class="sourceLineNo">2990</span> if (n == null) {<a name="line.2990"></a>
  2999. <span class="sourceLineNo">2991</span> include = !this.ignoreNullValues;<a name="line.2991"></a>
  3000. <span class="sourceLineNo">2992</span> }<a name="line.2992"></a>
  3001. <span class="sourceLineNo">2993</span> else {<a name="line.2993"></a>
  3002. <span class="sourceLineNo">2994</span> double v = n.doubleValue();<a name="line.2994"></a>
  3003. <span class="sourceLineNo">2995</span> if (v == 0.0) {<a name="line.2995"></a>
  3004. <span class="sourceLineNo">2996</span> include = !this.ignoreZeroValues;<a name="line.2996"></a>
  3005. <span class="sourceLineNo">2997</span> }<a name="line.2997"></a>
  3006. <span class="sourceLineNo">2998</span> else {<a name="line.2998"></a>
  3007. <span class="sourceLineNo">2999</span> include = v &gt; 0.0;<a name="line.2999"></a>
  3008. <span class="sourceLineNo">3000</span> }<a name="line.3000"></a>
  3009. <span class="sourceLineNo">3001</span> }<a name="line.3001"></a>
  3010. <span class="sourceLineNo">3002</span> if (include) {<a name="line.3002"></a>
  3011. <span class="sourceLineNo">3003</span> String label = this.legendLabelGenerator.generateSectionLabel(<a name="line.3003"></a>
  3012. <span class="sourceLineNo">3004</span> this.dataset, key);<a name="line.3004"></a>
  3013. <span class="sourceLineNo">3005</span> if (label != null) {<a name="line.3005"></a>
  3014. <span class="sourceLineNo">3006</span> String description = label;<a name="line.3006"></a>
  3015. <span class="sourceLineNo">3007</span> String toolTipText = null;<a name="line.3007"></a>
  3016. <span class="sourceLineNo">3008</span> if (this.legendLabelToolTipGenerator != null) {<a name="line.3008"></a>
  3017. <span class="sourceLineNo">3009</span> toolTipText = this.legendLabelToolTipGenerator<a name="line.3009"></a>
  3018. <span class="sourceLineNo">3010</span> .generateSectionLabel(this.dataset, key);<a name="line.3010"></a>
  3019. <span class="sourceLineNo">3011</span> }<a name="line.3011"></a>
  3020. <span class="sourceLineNo">3012</span> String urlText = null;<a name="line.3012"></a>
  3021. <span class="sourceLineNo">3013</span> if (this.legendLabelURLGenerator != null) {<a name="line.3013"></a>
  3022. <span class="sourceLineNo">3014</span> urlText = this.legendLabelURLGenerator.generateURL(<a name="line.3014"></a>
  3023. <span class="sourceLineNo">3015</span> this.dataset, key, this.pieIndex);<a name="line.3015"></a>
  3024. <span class="sourceLineNo">3016</span> }<a name="line.3016"></a>
  3025. <span class="sourceLineNo">3017</span> Paint paint = lookupSectionPaint(key);<a name="line.3017"></a>
  3026. <span class="sourceLineNo">3018</span> Paint outlinePaint = lookupSectionOutlinePaint(key);<a name="line.3018"></a>
  3027. <span class="sourceLineNo">3019</span> Stroke outlineStroke = lookupSectionOutlineStroke(key);<a name="line.3019"></a>
  3028. <span class="sourceLineNo">3020</span> LegendItem item = new LegendItem(label, description,<a name="line.3020"></a>
  3029. <span class="sourceLineNo">3021</span> toolTipText, urlText, true, shape, true, paint,<a name="line.3021"></a>
  3030. <span class="sourceLineNo">3022</span> true, outlinePaint, outlineStroke,<a name="line.3022"></a>
  3031. <span class="sourceLineNo">3023</span> false, // line not visible<a name="line.3023"></a>
  3032. <span class="sourceLineNo">3024</span> new Line2D.Float(), new BasicStroke(), Color.black);<a name="line.3024"></a>
  3033. <span class="sourceLineNo">3025</span> item.setDataset(getDataset());<a name="line.3025"></a>
  3034. <span class="sourceLineNo">3026</span> item.setSeriesIndex(this.dataset.getIndex(key));<a name="line.3026"></a>
  3035. <span class="sourceLineNo">3027</span> item.setSeriesKey(key);<a name="line.3027"></a>
  3036. <span class="sourceLineNo">3028</span> result.add(item);<a name="line.3028"></a>
  3037. <span class="sourceLineNo">3029</span> }<a name="line.3029"></a>
  3038. <span class="sourceLineNo">3030</span> section++;<a name="line.3030"></a>
  3039. <span class="sourceLineNo">3031</span> }<a name="line.3031"></a>
  3040. <span class="sourceLineNo">3032</span> else {<a name="line.3032"></a>
  3041. <span class="sourceLineNo">3033</span> section++;<a name="line.3033"></a>
  3042. <span class="sourceLineNo">3034</span> }<a name="line.3034"></a>
  3043. <span class="sourceLineNo">3035</span> }<a name="line.3035"></a>
  3044. <span class="sourceLineNo">3036</span> return result;<a name="line.3036"></a>
  3045. <span class="sourceLineNo">3037</span> }<a name="line.3037"></a>
  3046. <span class="sourceLineNo">3038</span><a name="line.3038"></a>
  3047. <span class="sourceLineNo">3039</span> /**<a name="line.3039"></a>
  3048. <span class="sourceLineNo">3040</span> * Returns a short string describing the type of plot.<a name="line.3040"></a>
  3049. <span class="sourceLineNo">3041</span> *<a name="line.3041"></a>
  3050. <span class="sourceLineNo">3042</span> * @return The plot type.<a name="line.3042"></a>
  3051. <span class="sourceLineNo">3043</span> */<a name="line.3043"></a>
  3052. <span class="sourceLineNo">3044</span> @Override<a name="line.3044"></a>
  3053. <span class="sourceLineNo">3045</span> public String getPlotType() {<a name="line.3045"></a>
  3054. <span class="sourceLineNo">3046</span> return localizationResources.getString("Pie_Plot");<a name="line.3046"></a>
  3055. <span class="sourceLineNo">3047</span> }<a name="line.3047"></a>
  3056. <span class="sourceLineNo">3048</span><a name="line.3048"></a>
  3057. <span class="sourceLineNo">3049</span> /**<a name="line.3049"></a>
  3058. <span class="sourceLineNo">3050</span> * Returns a rectangle that can be used to create a pie section (taking<a name="line.3050"></a>
  3059. <span class="sourceLineNo">3051</span> * into account the amount by which the pie section is 'exploded').<a name="line.3051"></a>
  3060. <span class="sourceLineNo">3052</span> *<a name="line.3052"></a>
  3061. <span class="sourceLineNo">3053</span> * @param unexploded the area inside which the unexploded pie sections are<a name="line.3053"></a>
  3062. <span class="sourceLineNo">3054</span> * drawn.<a name="line.3054"></a>
  3063. <span class="sourceLineNo">3055</span> * @param exploded the area inside which the exploded pie sections are<a name="line.3055"></a>
  3064. <span class="sourceLineNo">3056</span> * drawn.<a name="line.3056"></a>
  3065. <span class="sourceLineNo">3057</span> * @param angle the start angle.<a name="line.3057"></a>
  3066. <span class="sourceLineNo">3058</span> * @param extent the extent of the arc.<a name="line.3058"></a>
  3067. <span class="sourceLineNo">3059</span> * @param explodePercent the amount by which the pie section is exploded.<a name="line.3059"></a>
  3068. <span class="sourceLineNo">3060</span> *<a name="line.3060"></a>
  3069. <span class="sourceLineNo">3061</span> * @return A rectangle that can be used to create a pie section.<a name="line.3061"></a>
  3070. <span class="sourceLineNo">3062</span> */<a name="line.3062"></a>
  3071. <span class="sourceLineNo">3063</span> protected Rectangle2D getArcBounds(Rectangle2D unexploded,<a name="line.3063"></a>
  3072. <span class="sourceLineNo">3064</span> Rectangle2D exploded,<a name="line.3064"></a>
  3073. <span class="sourceLineNo">3065</span> double angle, double extent,<a name="line.3065"></a>
  3074. <span class="sourceLineNo">3066</span> double explodePercent) {<a name="line.3066"></a>
  3075. <span class="sourceLineNo">3067</span><a name="line.3067"></a>
  3076. <span class="sourceLineNo">3068</span> if (explodePercent == 0.0) {<a name="line.3068"></a>
  3077. <span class="sourceLineNo">3069</span> return unexploded;<a name="line.3069"></a>
  3078. <span class="sourceLineNo">3070</span> }<a name="line.3070"></a>
  3079. <span class="sourceLineNo">3071</span> Arc2D arc1 = new Arc2D.Double(unexploded, angle, extent / 2,<a name="line.3071"></a>
  3080. <span class="sourceLineNo">3072</span> Arc2D.OPEN);<a name="line.3072"></a>
  3081. <span class="sourceLineNo">3073</span> Point2D point1 = arc1.getEndPoint();<a name="line.3073"></a>
  3082. <span class="sourceLineNo">3074</span> Arc2D.Double arc2 = new Arc2D.Double(exploded, angle, extent / 2,<a name="line.3074"></a>
  3083. <span class="sourceLineNo">3075</span> Arc2D.OPEN);<a name="line.3075"></a>
  3084. <span class="sourceLineNo">3076</span> Point2D point2 = arc2.getEndPoint();<a name="line.3076"></a>
  3085. <span class="sourceLineNo">3077</span> double deltaX = (point1.getX() - point2.getX()) * explodePercent;<a name="line.3077"></a>
  3086. <span class="sourceLineNo">3078</span> double deltaY = (point1.getY() - point2.getY()) * explodePercent;<a name="line.3078"></a>
  3087. <span class="sourceLineNo">3079</span> return new Rectangle2D.Double(unexploded.getX() - deltaX,<a name="line.3079"></a>
  3088. <span class="sourceLineNo">3080</span> unexploded.getY() - deltaY, unexploded.getWidth(),<a name="line.3080"></a>
  3089. <span class="sourceLineNo">3081</span> unexploded.getHeight());<a name="line.3081"></a>
  3090. <span class="sourceLineNo">3082</span> }<a name="line.3082"></a>
  3091. <span class="sourceLineNo">3083</span><a name="line.3083"></a>
  3092. <span class="sourceLineNo">3084</span> /**<a name="line.3084"></a>
  3093. <span class="sourceLineNo">3085</span> * Draws a section label on the left side of the pie chart.<a name="line.3085"></a>
  3094. <span class="sourceLineNo">3086</span> *<a name="line.3086"></a>
  3095. <span class="sourceLineNo">3087</span> * @param g2 the graphics device.<a name="line.3087"></a>
  3096. <span class="sourceLineNo">3088</span> * @param state the state.<a name="line.3088"></a>
  3097. <span class="sourceLineNo">3089</span> * @param record the label record.<a name="line.3089"></a>
  3098. <span class="sourceLineNo">3090</span> */<a name="line.3090"></a>
  3099. <span class="sourceLineNo">3091</span> protected void drawLeftLabel(Graphics2D g2, PiePlotState state,<a name="line.3091"></a>
  3100. <span class="sourceLineNo">3092</span> PieLabelRecord record) {<a name="line.3092"></a>
  3101. <span class="sourceLineNo">3093</span><a name="line.3093"></a>
  3102. <span class="sourceLineNo">3094</span> double anchorX = state.getLinkArea().getMinX();<a name="line.3094"></a>
  3103. <span class="sourceLineNo">3095</span> double targetX = anchorX - record.getGap();<a name="line.3095"></a>
  3104. <span class="sourceLineNo">3096</span> double targetY = record.getAllocatedY();<a name="line.3096"></a>
  3105. <span class="sourceLineNo">3097</span><a name="line.3097"></a>
  3106. <span class="sourceLineNo">3098</span> if (this.labelLinksVisible) {<a name="line.3098"></a>
  3107. <span class="sourceLineNo">3099</span> double theta = record.getAngle();<a name="line.3099"></a>
  3108. <span class="sourceLineNo">3100</span> double linkX = state.getPieCenterX() + Math.cos(theta)<a name="line.3100"></a>
  3109. <span class="sourceLineNo">3101</span> * state.getPieWRadius() * record.getLinkPercent();<a name="line.3101"></a>
  3110. <span class="sourceLineNo">3102</span> double linkY = state.getPieCenterY() - Math.sin(theta)<a name="line.3102"></a>
  3111. <span class="sourceLineNo">3103</span> * state.getPieHRadius() * record.getLinkPercent();<a name="line.3103"></a>
  3112. <span class="sourceLineNo">3104</span> double elbowX = state.getPieCenterX() + Math.cos(theta)<a name="line.3104"></a>
  3113. <span class="sourceLineNo">3105</span> * state.getLinkArea().getWidth() / 2.0;<a name="line.3105"></a>
  3114. <span class="sourceLineNo">3106</span> double elbowY = state.getPieCenterY() - Math.sin(theta)<a name="line.3106"></a>
  3115. <span class="sourceLineNo">3107</span> * state.getLinkArea().getHeight() / 2.0;<a name="line.3107"></a>
  3116. <span class="sourceLineNo">3108</span> double anchorY = elbowY;<a name="line.3108"></a>
  3117. <span class="sourceLineNo">3109</span> g2.setPaint(this.labelLinkPaint);<a name="line.3109"></a>
  3118. <span class="sourceLineNo">3110</span> g2.setStroke(this.labelLinkStroke);<a name="line.3110"></a>
  3119. <span class="sourceLineNo">3111</span> PieLabelLinkStyle style = getLabelLinkStyle();<a name="line.3111"></a>
  3120. <span class="sourceLineNo">3112</span> if (style.equals(PieLabelLinkStyle.STANDARD)) {<a name="line.3112"></a>
  3121. <span class="sourceLineNo">3113</span> g2.draw(new Line2D.Double(linkX, linkY, elbowX, elbowY));<a name="line.3113"></a>
  3122. <span class="sourceLineNo">3114</span> g2.draw(new Line2D.Double(anchorX, anchorY, elbowX, elbowY));<a name="line.3114"></a>
  3123. <span class="sourceLineNo">3115</span> g2.draw(new Line2D.Double(anchorX, anchorY, targetX, targetY));<a name="line.3115"></a>
  3124. <span class="sourceLineNo">3116</span> }<a name="line.3116"></a>
  3125. <span class="sourceLineNo">3117</span> else if (style.equals(PieLabelLinkStyle.QUAD_CURVE)) {<a name="line.3117"></a>
  3126. <span class="sourceLineNo">3118</span> QuadCurve2D q = new QuadCurve2D.Float();<a name="line.3118"></a>
  3127. <span class="sourceLineNo">3119</span> q.setCurve(targetX, targetY, anchorX, anchorY, elbowX, elbowY);<a name="line.3119"></a>
  3128. <span class="sourceLineNo">3120</span> g2.draw(q);<a name="line.3120"></a>
  3129. <span class="sourceLineNo">3121</span> g2.draw(new Line2D.Double(elbowX, elbowY, linkX, linkY));<a name="line.3121"></a>
  3130. <span class="sourceLineNo">3122</span> }<a name="line.3122"></a>
  3131. <span class="sourceLineNo">3123</span> else if (style.equals(PieLabelLinkStyle.CUBIC_CURVE)) {<a name="line.3123"></a>
  3132. <span class="sourceLineNo">3124</span> CubicCurve2D c = new CubicCurve2D .Float();<a name="line.3124"></a>
  3133. <span class="sourceLineNo">3125</span> c.setCurve(targetX, targetY, anchorX, anchorY, elbowX, elbowY,<a name="line.3125"></a>
  3134. <span class="sourceLineNo">3126</span> linkX, linkY);<a name="line.3126"></a>
  3135. <span class="sourceLineNo">3127</span> g2.draw(c);<a name="line.3127"></a>
  3136. <span class="sourceLineNo">3128</span> }<a name="line.3128"></a>
  3137. <span class="sourceLineNo">3129</span> }<a name="line.3129"></a>
  3138. <span class="sourceLineNo">3130</span> TextBox tb = record.getLabel();<a name="line.3130"></a>
  3139. <span class="sourceLineNo">3131</span> tb.draw(g2, (float) targetX, (float) targetY, RectangleAnchor.RIGHT);<a name="line.3131"></a>
  3140. <span class="sourceLineNo">3132</span><a name="line.3132"></a>
  3141. <span class="sourceLineNo">3133</span> }<a name="line.3133"></a>
  3142. <span class="sourceLineNo">3134</span><a name="line.3134"></a>
  3143. <span class="sourceLineNo">3135</span> /**<a name="line.3135"></a>
  3144. <span class="sourceLineNo">3136</span> * Draws a section label on the right side of the pie chart.<a name="line.3136"></a>
  3145. <span class="sourceLineNo">3137</span> *<a name="line.3137"></a>
  3146. <span class="sourceLineNo">3138</span> * @param g2 the graphics device.<a name="line.3138"></a>
  3147. <span class="sourceLineNo">3139</span> * @param state the state.<a name="line.3139"></a>
  3148. <span class="sourceLineNo">3140</span> * @param record the label record.<a name="line.3140"></a>
  3149. <span class="sourceLineNo">3141</span> */<a name="line.3141"></a>
  3150. <span class="sourceLineNo">3142</span> protected void drawRightLabel(Graphics2D g2, PiePlotState state,<a name="line.3142"></a>
  3151. <span class="sourceLineNo">3143</span> PieLabelRecord record) {<a name="line.3143"></a>
  3152. <span class="sourceLineNo">3144</span><a name="line.3144"></a>
  3153. <span class="sourceLineNo">3145</span> double anchorX = state.getLinkArea().getMaxX();<a name="line.3145"></a>
  3154. <span class="sourceLineNo">3146</span> double targetX = anchorX + record.getGap();<a name="line.3146"></a>
  3155. <span class="sourceLineNo">3147</span> double targetY = record.getAllocatedY();<a name="line.3147"></a>
  3156. <span class="sourceLineNo">3148</span><a name="line.3148"></a>
  3157. <span class="sourceLineNo">3149</span> if (this.labelLinksVisible) {<a name="line.3149"></a>
  3158. <span class="sourceLineNo">3150</span> double theta = record.getAngle();<a name="line.3150"></a>
  3159. <span class="sourceLineNo">3151</span> double linkX = state.getPieCenterX() + Math.cos(theta)<a name="line.3151"></a>
  3160. <span class="sourceLineNo">3152</span> * state.getPieWRadius() * record.getLinkPercent();<a name="line.3152"></a>
  3161. <span class="sourceLineNo">3153</span> double linkY = state.getPieCenterY() - Math.sin(theta)<a name="line.3153"></a>
  3162. <span class="sourceLineNo">3154</span> * state.getPieHRadius() * record.getLinkPercent();<a name="line.3154"></a>
  3163. <span class="sourceLineNo">3155</span> double elbowX = state.getPieCenterX() + Math.cos(theta)<a name="line.3155"></a>
  3164. <span class="sourceLineNo">3156</span> * state.getLinkArea().getWidth() / 2.0;<a name="line.3156"></a>
  3165. <span class="sourceLineNo">3157</span> double elbowY = state.getPieCenterY() - Math.sin(theta)<a name="line.3157"></a>
  3166. <span class="sourceLineNo">3158</span> * state.getLinkArea().getHeight() / 2.0;<a name="line.3158"></a>
  3167. <span class="sourceLineNo">3159</span> double anchorY = elbowY;<a name="line.3159"></a>
  3168. <span class="sourceLineNo">3160</span> g2.setPaint(this.labelLinkPaint);<a name="line.3160"></a>
  3169. <span class="sourceLineNo">3161</span> g2.setStroke(this.labelLinkStroke);<a name="line.3161"></a>
  3170. <span class="sourceLineNo">3162</span> PieLabelLinkStyle style = getLabelLinkStyle();<a name="line.3162"></a>
  3171. <span class="sourceLineNo">3163</span> if (style.equals(PieLabelLinkStyle.STANDARD)) {<a name="line.3163"></a>
  3172. <span class="sourceLineNo">3164</span> g2.draw(new Line2D.Double(linkX, linkY, elbowX, elbowY));<a name="line.3164"></a>
  3173. <span class="sourceLineNo">3165</span> g2.draw(new Line2D.Double(anchorX, anchorY, elbowX, elbowY));<a name="line.3165"></a>
  3174. <span class="sourceLineNo">3166</span> g2.draw(new Line2D.Double(anchorX, anchorY, targetX, targetY));<a name="line.3166"></a>
  3175. <span class="sourceLineNo">3167</span> }<a name="line.3167"></a>
  3176. <span class="sourceLineNo">3168</span> else if (style.equals(PieLabelLinkStyle.QUAD_CURVE)) {<a name="line.3168"></a>
  3177. <span class="sourceLineNo">3169</span> QuadCurve2D q = new QuadCurve2D.Float();<a name="line.3169"></a>
  3178. <span class="sourceLineNo">3170</span> q.setCurve(targetX, targetY, anchorX, anchorY, elbowX, elbowY);<a name="line.3170"></a>
  3179. <span class="sourceLineNo">3171</span> g2.draw(q);<a name="line.3171"></a>
  3180. <span class="sourceLineNo">3172</span> g2.draw(new Line2D.Double(elbowX, elbowY, linkX, linkY));<a name="line.3172"></a>
  3181. <span class="sourceLineNo">3173</span> }<a name="line.3173"></a>
  3182. <span class="sourceLineNo">3174</span> else if (style.equals(PieLabelLinkStyle.CUBIC_CURVE)) {<a name="line.3174"></a>
  3183. <span class="sourceLineNo">3175</span> CubicCurve2D c = new CubicCurve2D .Float();<a name="line.3175"></a>
  3184. <span class="sourceLineNo">3176</span> c.setCurve(targetX, targetY, anchorX, anchorY, elbowX, elbowY,<a name="line.3176"></a>
  3185. <span class="sourceLineNo">3177</span> linkX, linkY);<a name="line.3177"></a>
  3186. <span class="sourceLineNo">3178</span> g2.draw(c);<a name="line.3178"></a>
  3187. <span class="sourceLineNo">3179</span> }<a name="line.3179"></a>
  3188. <span class="sourceLineNo">3180</span> }<a name="line.3180"></a>
  3189. <span class="sourceLineNo">3181</span><a name="line.3181"></a>
  3190. <span class="sourceLineNo">3182</span> TextBox tb = record.getLabel();<a name="line.3182"></a>
  3191. <span class="sourceLineNo">3183</span> tb.draw(g2, (float) targetX, (float) targetY, RectangleAnchor.LEFT);<a name="line.3183"></a>
  3192. <span class="sourceLineNo">3184</span><a name="line.3184"></a>
  3193. <span class="sourceLineNo">3185</span> }<a name="line.3185"></a>
  3194. <span class="sourceLineNo">3186</span><a name="line.3186"></a>
  3195. <span class="sourceLineNo">3187</span> /**<a name="line.3187"></a>
  3196. <span class="sourceLineNo">3188</span> * Returns the center for the specified section.<a name="line.3188"></a>
  3197. <span class="sourceLineNo">3189</span> * Checks to see if the section is exploded and recalculates the<a name="line.3189"></a>
  3198. <span class="sourceLineNo">3190</span> * new center if so.<a name="line.3190"></a>
  3199. <span class="sourceLineNo">3191</span> *<a name="line.3191"></a>
  3200. <span class="sourceLineNo">3192</span> * @param state PiePlotState<a name="line.3192"></a>
  3201. <span class="sourceLineNo">3193</span> * @param key section key.<a name="line.3193"></a>
  3202. <span class="sourceLineNo">3194</span> *<a name="line.3194"></a>
  3203. <span class="sourceLineNo">3195</span> * @return The center for the specified section.<a name="line.3195"></a>
  3204. <span class="sourceLineNo">3196</span> *<a name="line.3196"></a>
  3205. <span class="sourceLineNo">3197</span> * @since 1.0.14<a name="line.3197"></a>
  3206. <span class="sourceLineNo">3198</span> */<a name="line.3198"></a>
  3207. <span class="sourceLineNo">3199</span> protected Point2D getArcCenter(PiePlotState state, Comparable key) {<a name="line.3199"></a>
  3208. <span class="sourceLineNo">3200</span> Point2D center = new Point2D.Double(state.getPieCenterX(), state<a name="line.3200"></a>
  3209. <span class="sourceLineNo">3201</span> .getPieCenterY());<a name="line.3201"></a>
  3210. <span class="sourceLineNo">3202</span><a name="line.3202"></a>
  3211. <span class="sourceLineNo">3203</span> double ep = getExplodePercent(key);<a name="line.3203"></a>
  3212. <span class="sourceLineNo">3204</span> double mep = getMaximumExplodePercent();<a name="line.3204"></a>
  3213. <span class="sourceLineNo">3205</span> if (mep &gt; 0.0) {<a name="line.3205"></a>
  3214. <span class="sourceLineNo">3206</span> ep = ep / mep;<a name="line.3206"></a>
  3215. <span class="sourceLineNo">3207</span> }<a name="line.3207"></a>
  3216. <span class="sourceLineNo">3208</span> if (ep != 0) {<a name="line.3208"></a>
  3217. <span class="sourceLineNo">3209</span> Rectangle2D pieArea = state.getPieArea();<a name="line.3209"></a>
  3218. <span class="sourceLineNo">3210</span> Rectangle2D expPieArea = state.getExplodedPieArea();<a name="line.3210"></a>
  3219. <span class="sourceLineNo">3211</span> double angle1, angle2;<a name="line.3211"></a>
  3220. <span class="sourceLineNo">3212</span> Number n = this.dataset.getValue(key);<a name="line.3212"></a>
  3221. <span class="sourceLineNo">3213</span> double value = n.doubleValue();<a name="line.3213"></a>
  3222. <span class="sourceLineNo">3214</span><a name="line.3214"></a>
  3223. <span class="sourceLineNo">3215</span> if (this.direction == Rotation.CLOCKWISE) {<a name="line.3215"></a>
  3224. <span class="sourceLineNo">3216</span> angle1 = state.getLatestAngle();<a name="line.3216"></a>
  3225. <span class="sourceLineNo">3217</span> angle2 = angle1 - value / state.getTotal() * 360.0;<a name="line.3217"></a>
  3226. <span class="sourceLineNo">3218</span> } else if (this.direction == Rotation.ANTICLOCKWISE) {<a name="line.3218"></a>
  3227. <span class="sourceLineNo">3219</span> angle1 = state.getLatestAngle();<a name="line.3219"></a>
  3228. <span class="sourceLineNo">3220</span> angle2 = angle1 + value / state.getTotal() * 360.0;<a name="line.3220"></a>
  3229. <span class="sourceLineNo">3221</span> } else {<a name="line.3221"></a>
  3230. <span class="sourceLineNo">3222</span> throw new IllegalStateException("Rotation type not recognised.");<a name="line.3222"></a>
  3231. <span class="sourceLineNo">3223</span> }<a name="line.3223"></a>
  3232. <span class="sourceLineNo">3224</span> double angle = (angle2 - angle1);<a name="line.3224"></a>
  3233. <span class="sourceLineNo">3225</span><a name="line.3225"></a>
  3234. <span class="sourceLineNo">3226</span> Arc2D arc1 = new Arc2D.Double(pieArea, angle1, angle / 2,<a name="line.3226"></a>
  3235. <span class="sourceLineNo">3227</span> Arc2D.OPEN);<a name="line.3227"></a>
  3236. <span class="sourceLineNo">3228</span> Point2D point1 = arc1.getEndPoint();<a name="line.3228"></a>
  3237. <span class="sourceLineNo">3229</span> Arc2D.Double arc2 = new Arc2D.Double(expPieArea, angle1, angle / 2,<a name="line.3229"></a>
  3238. <span class="sourceLineNo">3230</span> Arc2D.OPEN);<a name="line.3230"></a>
  3239. <span class="sourceLineNo">3231</span> Point2D point2 = arc2.getEndPoint();<a name="line.3231"></a>
  3240. <span class="sourceLineNo">3232</span> double deltaX = (point1.getX() - point2.getX()) * ep;<a name="line.3232"></a>
  3241. <span class="sourceLineNo">3233</span> double deltaY = (point1.getY() - point2.getY()) * ep;<a name="line.3233"></a>
  3242. <span class="sourceLineNo">3234</span><a name="line.3234"></a>
  3243. <span class="sourceLineNo">3235</span> center = new Point2D.Double(state.getPieCenterX() - deltaX,<a name="line.3235"></a>
  3244. <span class="sourceLineNo">3236</span> state.getPieCenterY() - deltaY);<a name="line.3236"></a>
  3245. <span class="sourceLineNo">3237</span><a name="line.3237"></a>
  3246. <span class="sourceLineNo">3238</span> }<a name="line.3238"></a>
  3247. <span class="sourceLineNo">3239</span> return center;<a name="line.3239"></a>
  3248. <span class="sourceLineNo">3240</span> }<a name="line.3240"></a>
  3249. <span class="sourceLineNo">3241</span><a name="line.3241"></a>
  3250. <span class="sourceLineNo">3242</span> /**<a name="line.3242"></a>
  3251. <span class="sourceLineNo">3243</span> * Returns the paint for the specified section. This is equivalent to<a name="line.3243"></a>
  3252. <span class="sourceLineNo">3244</span> * &lt;code&gt;lookupSectionPaint(section)&lt;/code&gt;.<a name="line.3244"></a>
  3253. <span class="sourceLineNo">3245</span> * Checks to see if the user set the Paint to be of type RadialGradientPaint<a name="line.3245"></a>
  3254. <span class="sourceLineNo">3246</span> * If so it adjusts the center and radius to match the Pie<a name="line.3246"></a>
  3255. <span class="sourceLineNo">3247</span> *<a name="line.3247"></a>
  3256. <span class="sourceLineNo">3248</span> * @param key the section key.<a name="line.3248"></a>
  3257. <span class="sourceLineNo">3249</span> * @param state PiePlotState.<a name="line.3249"></a>
  3258. <span class="sourceLineNo">3250</span> *<a name="line.3250"></a>
  3259. <span class="sourceLineNo">3251</span> * @return The paint for the specified section.<a name="line.3251"></a>
  3260. <span class="sourceLineNo">3252</span> *<a name="line.3252"></a>
  3261. <span class="sourceLineNo">3253</span> * @since 1.0.14<a name="line.3253"></a>
  3262. <span class="sourceLineNo">3254</span> */<a name="line.3254"></a>
  3263. <span class="sourceLineNo">3255</span> protected Paint lookupSectionPaint(Comparable key, PiePlotState state) {<a name="line.3255"></a>
  3264. <span class="sourceLineNo">3256</span> Paint paint = lookupSectionPaint(key, getAutoPopulateSectionPaint());<a name="line.3256"></a>
  3265. <span class="sourceLineNo">3257</span> // for a RadialGradientPaint we adjust the center and radius to match<a name="line.3257"></a>
  3266. <span class="sourceLineNo">3258</span> // the current pie segment...<a name="line.3258"></a>
  3267. <span class="sourceLineNo">3259</span> if (paint instanceof RadialGradientPaint) {<a name="line.3259"></a>
  3268. <span class="sourceLineNo">3260</span> RadialGradientPaint rgp = (RadialGradientPaint) paint;<a name="line.3260"></a>
  3269. <span class="sourceLineNo">3261</span> Point2D center = getArcCenter(state, key);<a name="line.3261"></a>
  3270. <span class="sourceLineNo">3262</span> float radius = (float) Math.max(state.getPieHRadius(), <a name="line.3262"></a>
  3271. <span class="sourceLineNo">3263</span> state.getPieWRadius());<a name="line.3263"></a>
  3272. <span class="sourceLineNo">3264</span> float[] fractions = rgp.getFractions();<a name="line.3264"></a>
  3273. <span class="sourceLineNo">3265</span> Color[] colors = rgp.getColors();<a name="line.3265"></a>
  3274. <span class="sourceLineNo">3266</span> paint = new RadialGradientPaint(center, radius, fractions, colors);<a name="line.3266"></a>
  3275. <span class="sourceLineNo">3267</span> }<a name="line.3267"></a>
  3276. <span class="sourceLineNo">3268</span> return paint;<a name="line.3268"></a>
  3277. <span class="sourceLineNo">3269</span> }<a name="line.3269"></a>
  3278. <span class="sourceLineNo">3270</span><a name="line.3270"></a>
  3279. <span class="sourceLineNo">3271</span> /**<a name="line.3271"></a>
  3280. <span class="sourceLineNo">3272</span> * Tests this plot for equality with an arbitrary object. Note that the<a name="line.3272"></a>
  3281. <span class="sourceLineNo">3273</span> * plot's dataset is NOT included in the test for equality.<a name="line.3273"></a>
  3282. <span class="sourceLineNo">3274</span> *<a name="line.3274"></a>
  3283. <span class="sourceLineNo">3275</span> * @param obj the object to test against (&lt;code&gt;null&lt;/code&gt; permitted).<a name="line.3275"></a>
  3284. <span class="sourceLineNo">3276</span> *<a name="line.3276"></a>
  3285. <span class="sourceLineNo">3277</span> * @return &lt;code&gt;true&lt;/code&gt; or &lt;code&gt;false&lt;/code&gt;.<a name="line.3277"></a>
  3286. <span class="sourceLineNo">3278</span> */<a name="line.3278"></a>
  3287. <span class="sourceLineNo">3279</span> @Override<a name="line.3279"></a>
  3288. <span class="sourceLineNo">3280</span> public boolean equals(Object obj) {<a name="line.3280"></a>
  3289. <span class="sourceLineNo">3281</span> if (obj == this) {<a name="line.3281"></a>
  3290. <span class="sourceLineNo">3282</span> return true;<a name="line.3282"></a>
  3291. <span class="sourceLineNo">3283</span> }<a name="line.3283"></a>
  3292. <span class="sourceLineNo">3284</span> if (!(obj instanceof PiePlot)) {<a name="line.3284"></a>
  3293. <span class="sourceLineNo">3285</span> return false;<a name="line.3285"></a>
  3294. <span class="sourceLineNo">3286</span> }<a name="line.3286"></a>
  3295. <span class="sourceLineNo">3287</span> if (!super.equals(obj)) {<a name="line.3287"></a>
  3296. <span class="sourceLineNo">3288</span> return false;<a name="line.3288"></a>
  3297. <span class="sourceLineNo">3289</span> }<a name="line.3289"></a>
  3298. <span class="sourceLineNo">3290</span> PiePlot that = (PiePlot) obj;<a name="line.3290"></a>
  3299. <span class="sourceLineNo">3291</span> if (this.pieIndex != that.pieIndex) {<a name="line.3291"></a>
  3300. <span class="sourceLineNo">3292</span> return false;<a name="line.3292"></a>
  3301. <span class="sourceLineNo">3293</span> }<a name="line.3293"></a>
  3302. <span class="sourceLineNo">3294</span> if (this.interiorGap != that.interiorGap) {<a name="line.3294"></a>
  3303. <span class="sourceLineNo">3295</span> return false;<a name="line.3295"></a>
  3304. <span class="sourceLineNo">3296</span> }<a name="line.3296"></a>
  3305. <span class="sourceLineNo">3297</span> if (this.circular != that.circular) {<a name="line.3297"></a>
  3306. <span class="sourceLineNo">3298</span> return false;<a name="line.3298"></a>
  3307. <span class="sourceLineNo">3299</span> }<a name="line.3299"></a>
  3308. <span class="sourceLineNo">3300</span> if (this.startAngle != that.startAngle) {<a name="line.3300"></a>
  3309. <span class="sourceLineNo">3301</span> return false;<a name="line.3301"></a>
  3310. <span class="sourceLineNo">3302</span> }<a name="line.3302"></a>
  3311. <span class="sourceLineNo">3303</span> if (this.direction != that.direction) {<a name="line.3303"></a>
  3312. <span class="sourceLineNo">3304</span> return false;<a name="line.3304"></a>
  3313. <span class="sourceLineNo">3305</span> }<a name="line.3305"></a>
  3314. <span class="sourceLineNo">3306</span> if (this.ignoreZeroValues != that.ignoreZeroValues) {<a name="line.3306"></a>
  3315. <span class="sourceLineNo">3307</span> return false;<a name="line.3307"></a>
  3316. <span class="sourceLineNo">3308</span> }<a name="line.3308"></a>
  3317. <span class="sourceLineNo">3309</span> if (this.ignoreNullValues != that.ignoreNullValues) {<a name="line.3309"></a>
  3318. <span class="sourceLineNo">3310</span> return false;<a name="line.3310"></a>
  3319. <span class="sourceLineNo">3311</span> }<a name="line.3311"></a>
  3320. <span class="sourceLineNo">3312</span> if (!PaintUtilities.equal(this.sectionPaint, that.sectionPaint)) {<a name="line.3312"></a>
  3321. <span class="sourceLineNo">3313</span> return false;<a name="line.3313"></a>
  3322. <span class="sourceLineNo">3314</span> }<a name="line.3314"></a>
  3323. <span class="sourceLineNo">3315</span> if (!ObjectUtilities.equal(this.sectionPaintMap,<a name="line.3315"></a>
  3324. <span class="sourceLineNo">3316</span> that.sectionPaintMap)) {<a name="line.3316"></a>
  3325. <span class="sourceLineNo">3317</span> return false;<a name="line.3317"></a>
  3326. <span class="sourceLineNo">3318</span> }<a name="line.3318"></a>
  3327. <span class="sourceLineNo">3319</span> if (!PaintUtilities.equal(this.baseSectionPaint,<a name="line.3319"></a>
  3328. <span class="sourceLineNo">3320</span> that.baseSectionPaint)) {<a name="line.3320"></a>
  3329. <span class="sourceLineNo">3321</span> return false;<a name="line.3321"></a>
  3330. <span class="sourceLineNo">3322</span> }<a name="line.3322"></a>
  3331. <span class="sourceLineNo">3323</span> if (this.sectionOutlinesVisible != that.sectionOutlinesVisible) {<a name="line.3323"></a>
  3332. <span class="sourceLineNo">3324</span> return false;<a name="line.3324"></a>
  3333. <span class="sourceLineNo">3325</span> }<a name="line.3325"></a>
  3334. <span class="sourceLineNo">3326</span> if (!PaintUtilities.equal(this.sectionOutlinePaint,<a name="line.3326"></a>
  3335. <span class="sourceLineNo">3327</span> that.sectionOutlinePaint)) {<a name="line.3327"></a>
  3336. <span class="sourceLineNo">3328</span> return false;<a name="line.3328"></a>
  3337. <span class="sourceLineNo">3329</span> }<a name="line.3329"></a>
  3338. <span class="sourceLineNo">3330</span> if (!ObjectUtilities.equal(this.sectionOutlinePaintMap,<a name="line.3330"></a>
  3339. <span class="sourceLineNo">3331</span> that.sectionOutlinePaintMap)) {<a name="line.3331"></a>
  3340. <span class="sourceLineNo">3332</span> return false;<a name="line.3332"></a>
  3341. <span class="sourceLineNo">3333</span> }<a name="line.3333"></a>
  3342. <span class="sourceLineNo">3334</span> if (!PaintUtilities.equal(this.baseSectionOutlinePaint,<a name="line.3334"></a>
  3343. <span class="sourceLineNo">3335</span> that.baseSectionOutlinePaint)) {<a name="line.3335"></a>
  3344. <span class="sourceLineNo">3336</span> return false;<a name="line.3336"></a>
  3345. <span class="sourceLineNo">3337</span> }<a name="line.3337"></a>
  3346. <span class="sourceLineNo">3338</span> if (!ObjectUtilities.equal(this.sectionOutlineStroke,<a name="line.3338"></a>
  3347. <span class="sourceLineNo">3339</span> that.sectionOutlineStroke)) {<a name="line.3339"></a>
  3348. <span class="sourceLineNo">3340</span> return false;<a name="line.3340"></a>
  3349. <span class="sourceLineNo">3341</span> }<a name="line.3341"></a>
  3350. <span class="sourceLineNo">3342</span> if (!ObjectUtilities.equal(this.sectionOutlineStrokeMap,<a name="line.3342"></a>
  3351. <span class="sourceLineNo">3343</span> that.sectionOutlineStrokeMap)) {<a name="line.3343"></a>
  3352. <span class="sourceLineNo">3344</span> return false;<a name="line.3344"></a>
  3353. <span class="sourceLineNo">3345</span> }<a name="line.3345"></a>
  3354. <span class="sourceLineNo">3346</span> if (!ObjectUtilities.equal(this.baseSectionOutlineStroke,<a name="line.3346"></a>
  3355. <span class="sourceLineNo">3347</span> that.baseSectionOutlineStroke)) {<a name="line.3347"></a>
  3356. <span class="sourceLineNo">3348</span> return false;<a name="line.3348"></a>
  3357. <span class="sourceLineNo">3349</span> }<a name="line.3349"></a>
  3358. <span class="sourceLineNo">3350</span> if (!PaintUtilities.equal(this.shadowPaint, that.shadowPaint)) {<a name="line.3350"></a>
  3359. <span class="sourceLineNo">3351</span> return false;<a name="line.3351"></a>
  3360. <span class="sourceLineNo">3352</span> }<a name="line.3352"></a>
  3361. <span class="sourceLineNo">3353</span> if (!(this.shadowXOffset == that.shadowXOffset)) {<a name="line.3353"></a>
  3362. <span class="sourceLineNo">3354</span> return false;<a name="line.3354"></a>
  3363. <span class="sourceLineNo">3355</span> }<a name="line.3355"></a>
  3364. <span class="sourceLineNo">3356</span> if (!(this.shadowYOffset == that.shadowYOffset)) {<a name="line.3356"></a>
  3365. <span class="sourceLineNo">3357</span> return false;<a name="line.3357"></a>
  3366. <span class="sourceLineNo">3358</span> }<a name="line.3358"></a>
  3367. <span class="sourceLineNo">3359</span> if (!ObjectUtilities.equal(this.explodePercentages,<a name="line.3359"></a>
  3368. <span class="sourceLineNo">3360</span> that.explodePercentages)) {<a name="line.3360"></a>
  3369. <span class="sourceLineNo">3361</span> return false;<a name="line.3361"></a>
  3370. <span class="sourceLineNo">3362</span> }<a name="line.3362"></a>
  3371. <span class="sourceLineNo">3363</span> if (!ObjectUtilities.equal(this.labelGenerator,<a name="line.3363"></a>
  3372. <span class="sourceLineNo">3364</span> that.labelGenerator)) {<a name="line.3364"></a>
  3373. <span class="sourceLineNo">3365</span> return false;<a name="line.3365"></a>
  3374. <span class="sourceLineNo">3366</span> }<a name="line.3366"></a>
  3375. <span class="sourceLineNo">3367</span> if (!ObjectUtilities.equal(this.labelFont, that.labelFont)) {<a name="line.3367"></a>
  3376. <span class="sourceLineNo">3368</span> return false;<a name="line.3368"></a>
  3377. <span class="sourceLineNo">3369</span> }<a name="line.3369"></a>
  3378. <span class="sourceLineNo">3370</span> if (!PaintUtilities.equal(this.labelPaint, that.labelPaint)) {<a name="line.3370"></a>
  3379. <span class="sourceLineNo">3371</span> return false;<a name="line.3371"></a>
  3380. <span class="sourceLineNo">3372</span> }<a name="line.3372"></a>
  3381. <span class="sourceLineNo">3373</span> if (!PaintUtilities.equal(this.labelBackgroundPaint,<a name="line.3373"></a>
  3382. <span class="sourceLineNo">3374</span> that.labelBackgroundPaint)) {<a name="line.3374"></a>
  3383. <span class="sourceLineNo">3375</span> return false;<a name="line.3375"></a>
  3384. <span class="sourceLineNo">3376</span> }<a name="line.3376"></a>
  3385. <span class="sourceLineNo">3377</span> if (!PaintUtilities.equal(this.labelOutlinePaint,<a name="line.3377"></a>
  3386. <span class="sourceLineNo">3378</span> that.labelOutlinePaint)) {<a name="line.3378"></a>
  3387. <span class="sourceLineNo">3379</span> return false;<a name="line.3379"></a>
  3388. <span class="sourceLineNo">3380</span> }<a name="line.3380"></a>
  3389. <span class="sourceLineNo">3381</span> if (!ObjectUtilities.equal(this.labelOutlineStroke,<a name="line.3381"></a>
  3390. <span class="sourceLineNo">3382</span> that.labelOutlineStroke)) {<a name="line.3382"></a>
  3391. <span class="sourceLineNo">3383</span> return false;<a name="line.3383"></a>
  3392. <span class="sourceLineNo">3384</span> }<a name="line.3384"></a>
  3393. <span class="sourceLineNo">3385</span> if (!PaintUtilities.equal(this.labelShadowPaint,<a name="line.3385"></a>
  3394. <span class="sourceLineNo">3386</span> that.labelShadowPaint)) {<a name="line.3386"></a>
  3395. <span class="sourceLineNo">3387</span> return false;<a name="line.3387"></a>
  3396. <span class="sourceLineNo">3388</span> }<a name="line.3388"></a>
  3397. <span class="sourceLineNo">3389</span> if (this.simpleLabels != that.simpleLabels) {<a name="line.3389"></a>
  3398. <span class="sourceLineNo">3390</span> return false;<a name="line.3390"></a>
  3399. <span class="sourceLineNo">3391</span> }<a name="line.3391"></a>
  3400. <span class="sourceLineNo">3392</span> if (!this.simpleLabelOffset.equals(that.simpleLabelOffset)) {<a name="line.3392"></a>
  3401. <span class="sourceLineNo">3393</span> return false;<a name="line.3393"></a>
  3402. <span class="sourceLineNo">3394</span> }<a name="line.3394"></a>
  3403. <span class="sourceLineNo">3395</span> if (!this.labelPadding.equals(that.labelPadding)) {<a name="line.3395"></a>
  3404. <span class="sourceLineNo">3396</span> return false;<a name="line.3396"></a>
  3405. <span class="sourceLineNo">3397</span> }<a name="line.3397"></a>
  3406. <span class="sourceLineNo">3398</span> if (!(this.maximumLabelWidth == that.maximumLabelWidth)) {<a name="line.3398"></a>
  3407. <span class="sourceLineNo">3399</span> return false;<a name="line.3399"></a>
  3408. <span class="sourceLineNo">3400</span> }<a name="line.3400"></a>
  3409. <span class="sourceLineNo">3401</span> if (!(this.labelGap == that.labelGap)) {<a name="line.3401"></a>
  3410. <span class="sourceLineNo">3402</span> return false;<a name="line.3402"></a>
  3411. <span class="sourceLineNo">3403</span> }<a name="line.3403"></a>
  3412. <span class="sourceLineNo">3404</span> if (!(this.labelLinkMargin == that.labelLinkMargin)) {<a name="line.3404"></a>
  3413. <span class="sourceLineNo">3405</span> return false;<a name="line.3405"></a>
  3414. <span class="sourceLineNo">3406</span> }<a name="line.3406"></a>
  3415. <span class="sourceLineNo">3407</span> if (this.labelLinksVisible != that.labelLinksVisible) {<a name="line.3407"></a>
  3416. <span class="sourceLineNo">3408</span> return false;<a name="line.3408"></a>
  3417. <span class="sourceLineNo">3409</span> }<a name="line.3409"></a>
  3418. <span class="sourceLineNo">3410</span> if (!this.labelLinkStyle.equals(that.labelLinkStyle)) {<a name="line.3410"></a>
  3419. <span class="sourceLineNo">3411</span> return false;<a name="line.3411"></a>
  3420. <span class="sourceLineNo">3412</span> }<a name="line.3412"></a>
  3421. <span class="sourceLineNo">3413</span> if (!PaintUtilities.equal(this.labelLinkPaint, that.labelLinkPaint)) {<a name="line.3413"></a>
  3422. <span class="sourceLineNo">3414</span> return false;<a name="line.3414"></a>
  3423. <span class="sourceLineNo">3415</span> }<a name="line.3415"></a>
  3424. <span class="sourceLineNo">3416</span> if (!ObjectUtilities.equal(this.labelLinkStroke,<a name="line.3416"></a>
  3425. <span class="sourceLineNo">3417</span> that.labelLinkStroke)) {<a name="line.3417"></a>
  3426. <span class="sourceLineNo">3418</span> return false;<a name="line.3418"></a>
  3427. <span class="sourceLineNo">3419</span> }<a name="line.3419"></a>
  3428. <span class="sourceLineNo">3420</span> if (!ObjectUtilities.equal(this.toolTipGenerator,<a name="line.3420"></a>
  3429. <span class="sourceLineNo">3421</span> that.toolTipGenerator)) {<a name="line.3421"></a>
  3430. <span class="sourceLineNo">3422</span> return false;<a name="line.3422"></a>
  3431. <span class="sourceLineNo">3423</span> }<a name="line.3423"></a>
  3432. <span class="sourceLineNo">3424</span> if (!ObjectUtilities.equal(this.urlGenerator, that.urlGenerator)) {<a name="line.3424"></a>
  3433. <span class="sourceLineNo">3425</span> return false;<a name="line.3425"></a>
  3434. <span class="sourceLineNo">3426</span> }<a name="line.3426"></a>
  3435. <span class="sourceLineNo">3427</span> if (!(this.minimumArcAngleToDraw == that.minimumArcAngleToDraw)) {<a name="line.3427"></a>
  3436. <span class="sourceLineNo">3428</span> return false;<a name="line.3428"></a>
  3437. <span class="sourceLineNo">3429</span> }<a name="line.3429"></a>
  3438. <span class="sourceLineNo">3430</span> if (!ShapeUtilities.equal(this.legendItemShape, that.legendItemShape)) {<a name="line.3430"></a>
  3439. <span class="sourceLineNo">3431</span> return false;<a name="line.3431"></a>
  3440. <span class="sourceLineNo">3432</span> }<a name="line.3432"></a>
  3441. <span class="sourceLineNo">3433</span> if (!ObjectUtilities.equal(this.legendLabelGenerator,<a name="line.3433"></a>
  3442. <span class="sourceLineNo">3434</span> that.legendLabelGenerator)) {<a name="line.3434"></a>
  3443. <span class="sourceLineNo">3435</span> return false;<a name="line.3435"></a>
  3444. <span class="sourceLineNo">3436</span> }<a name="line.3436"></a>
  3445. <span class="sourceLineNo">3437</span> if (!ObjectUtilities.equal(this.legendLabelToolTipGenerator,<a name="line.3437"></a>
  3446. <span class="sourceLineNo">3438</span> that.legendLabelToolTipGenerator)) {<a name="line.3438"></a>
  3447. <span class="sourceLineNo">3439</span> return false;<a name="line.3439"></a>
  3448. <span class="sourceLineNo">3440</span> }<a name="line.3440"></a>
  3449. <span class="sourceLineNo">3441</span> if (!ObjectUtilities.equal(this.legendLabelURLGenerator,<a name="line.3441"></a>
  3450. <span class="sourceLineNo">3442</span> that.legendLabelURLGenerator)) {<a name="line.3442"></a>
  3451. <span class="sourceLineNo">3443</span> return false;<a name="line.3443"></a>
  3452. <span class="sourceLineNo">3444</span> }<a name="line.3444"></a>
  3453. <span class="sourceLineNo">3445</span> if (this.autoPopulateSectionPaint != that.autoPopulateSectionPaint) {<a name="line.3445"></a>
  3454. <span class="sourceLineNo">3446</span> return false;<a name="line.3446"></a>
  3455. <span class="sourceLineNo">3447</span> }<a name="line.3447"></a>
  3456. <span class="sourceLineNo">3448</span> if (this.autoPopulateSectionOutlinePaint<a name="line.3448"></a>
  3457. <span class="sourceLineNo">3449</span> != that.autoPopulateSectionOutlinePaint) {<a name="line.3449"></a>
  3458. <span class="sourceLineNo">3450</span> return false;<a name="line.3450"></a>
  3459. <span class="sourceLineNo">3451</span> }<a name="line.3451"></a>
  3460. <span class="sourceLineNo">3452</span> if (this.autoPopulateSectionOutlineStroke<a name="line.3452"></a>
  3461. <span class="sourceLineNo">3453</span> != that.autoPopulateSectionOutlineStroke) {<a name="line.3453"></a>
  3462. <span class="sourceLineNo">3454</span> return false;<a name="line.3454"></a>
  3463. <span class="sourceLineNo">3455</span> }<a name="line.3455"></a>
  3464. <span class="sourceLineNo">3456</span> if (!ObjectUtilities.equal(this.shadowGenerator,<a name="line.3456"></a>
  3465. <span class="sourceLineNo">3457</span> that.shadowGenerator)) {<a name="line.3457"></a>
  3466. <span class="sourceLineNo">3458</span> return false;<a name="line.3458"></a>
  3467. <span class="sourceLineNo">3459</span> }<a name="line.3459"></a>
  3468. <span class="sourceLineNo">3460</span> // can't find any difference...<a name="line.3460"></a>
  3469. <span class="sourceLineNo">3461</span> return true;<a name="line.3461"></a>
  3470. <span class="sourceLineNo">3462</span> }<a name="line.3462"></a>
  3471. <span class="sourceLineNo">3463</span><a name="line.3463"></a>
  3472. <span class="sourceLineNo">3464</span> /**<a name="line.3464"></a>
  3473. <span class="sourceLineNo">3465</span> * Returns a clone of the plot.<a name="line.3465"></a>
  3474. <span class="sourceLineNo">3466</span> *<a name="line.3466"></a>
  3475. <span class="sourceLineNo">3467</span> * @return A clone.<a name="line.3467"></a>
  3476. <span class="sourceLineNo">3468</span> *<a name="line.3468"></a>
  3477. <span class="sourceLineNo">3469</span> * @throws CloneNotSupportedException if some component of the plot does<a name="line.3469"></a>
  3478. <span class="sourceLineNo">3470</span> * not support cloning.<a name="line.3470"></a>
  3479. <span class="sourceLineNo">3471</span> */<a name="line.3471"></a>
  3480. <span class="sourceLineNo">3472</span> @Override<a name="line.3472"></a>
  3481. <span class="sourceLineNo">3473</span> public Object clone() throws CloneNotSupportedException {<a name="line.3473"></a>
  3482. <span class="sourceLineNo">3474</span> PiePlot clone = (PiePlot) super.clone();<a name="line.3474"></a>
  3483. <span class="sourceLineNo">3475</span> clone.sectionPaintMap = (PaintMap) this.sectionPaintMap.clone();<a name="line.3475"></a>
  3484. <span class="sourceLineNo">3476</span> clone.sectionOutlinePaintMap <a name="line.3476"></a>
  3485. <span class="sourceLineNo">3477</span> = (PaintMap) this.sectionOutlinePaintMap.clone();<a name="line.3477"></a>
  3486. <span class="sourceLineNo">3478</span> clone.sectionOutlineStrokeMap <a name="line.3478"></a>
  3487. <span class="sourceLineNo">3479</span> = (StrokeMap) this.sectionOutlineStrokeMap.clone();<a name="line.3479"></a>
  3488. <span class="sourceLineNo">3480</span> clone.explodePercentages <a name="line.3480"></a>
  3489. <span class="sourceLineNo">3481</span> = new TreeMap&lt;Comparable&lt;?&gt;, Number&gt;(this.explodePercentages);<a name="line.3481"></a>
  3490. <span class="sourceLineNo">3482</span> if (this.labelGenerator != null) {<a name="line.3482"></a>
  3491. <span class="sourceLineNo">3483</span> clone.labelGenerator = (PieSectionLabelGenerator) <a name="line.3483"></a>
  3492. <span class="sourceLineNo">3484</span> ObjectUtilities.clone(this.labelGenerator);<a name="line.3484"></a>
  3493. <span class="sourceLineNo">3485</span> }<a name="line.3485"></a>
  3494. <span class="sourceLineNo">3486</span> if (clone.dataset != null) {<a name="line.3486"></a>
  3495. <span class="sourceLineNo">3487</span> clone.dataset.addChangeListener(clone);<a name="line.3487"></a>
  3496. <span class="sourceLineNo">3488</span> }<a name="line.3488"></a>
  3497. <span class="sourceLineNo">3489</span> if (this.urlGenerator instanceof PublicCloneable) {<a name="line.3489"></a>
  3498. <span class="sourceLineNo">3490</span> clone.urlGenerator = (PieURLGenerator) ObjectUtilities.clone(<a name="line.3490"></a>
  3499. <span class="sourceLineNo">3491</span> this.urlGenerator);<a name="line.3491"></a>
  3500. <span class="sourceLineNo">3492</span> }<a name="line.3492"></a>
  3501. <span class="sourceLineNo">3493</span> clone.legendItemShape = ShapeUtilities.clone(this.legendItemShape);<a name="line.3493"></a>
  3502. <span class="sourceLineNo">3494</span> if (this.legendLabelGenerator != null) {<a name="line.3494"></a>
  3503. <span class="sourceLineNo">3495</span> clone.legendLabelGenerator = (PieSectionLabelGenerator)<a name="line.3495"></a>
  3504. <span class="sourceLineNo">3496</span> ObjectUtilities.clone(this.legendLabelGenerator);<a name="line.3496"></a>
  3505. <span class="sourceLineNo">3497</span> }<a name="line.3497"></a>
  3506. <span class="sourceLineNo">3498</span> if (this.legendLabelToolTipGenerator != null) {<a name="line.3498"></a>
  3507. <span class="sourceLineNo">3499</span> clone.legendLabelToolTipGenerator = (PieSectionLabelGenerator)<a name="line.3499"></a>
  3508. <span class="sourceLineNo">3500</span> ObjectUtilities.clone(this.legendLabelToolTipGenerator);<a name="line.3500"></a>
  3509. <span class="sourceLineNo">3501</span> }<a name="line.3501"></a>
  3510. <span class="sourceLineNo">3502</span> if (this.legendLabelURLGenerator instanceof PublicCloneable) {<a name="line.3502"></a>
  3511. <span class="sourceLineNo">3503</span> clone.legendLabelURLGenerator = (PieURLGenerator)<a name="line.3503"></a>
  3512. <span class="sourceLineNo">3504</span> ObjectUtilities.clone(this.legendLabelURLGenerator);<a name="line.3504"></a>
  3513. <span class="sourceLineNo">3505</span> }<a name="line.3505"></a>
  3514. <span class="sourceLineNo">3506</span> return clone;<a name="line.3506"></a>
  3515. <span class="sourceLineNo">3507</span> }<a name="line.3507"></a>
  3516. <span class="sourceLineNo">3508</span><a name="line.3508"></a>
  3517. <span class="sourceLineNo">3509</span> /**<a name="line.3509"></a>
  3518. <span class="sourceLineNo">3510</span> * Provides serialization support.<a name="line.3510"></a>
  3519. <span class="sourceLineNo">3511</span> *<a name="line.3511"></a>
  3520. <span class="sourceLineNo">3512</span> * @param stream the output stream.<a name="line.3512"></a>
  3521. <span class="sourceLineNo">3513</span> *<a name="line.3513"></a>
  3522. <span class="sourceLineNo">3514</span> * @throws IOException if there is an I/O error.<a name="line.3514"></a>
  3523. <span class="sourceLineNo">3515</span> */<a name="line.3515"></a>
  3524. <span class="sourceLineNo">3516</span> private void writeObject(ObjectOutputStream stream) throws IOException {<a name="line.3516"></a>
  3525. <span class="sourceLineNo">3517</span> stream.defaultWriteObject();<a name="line.3517"></a>
  3526. <span class="sourceLineNo">3518</span> SerialUtilities.writePaint(this.sectionPaint, stream);<a name="line.3518"></a>
  3527. <span class="sourceLineNo">3519</span> SerialUtilities.writePaint(this.baseSectionPaint, stream);<a name="line.3519"></a>
  3528. <span class="sourceLineNo">3520</span> SerialUtilities.writePaint(this.sectionOutlinePaint, stream);<a name="line.3520"></a>
  3529. <span class="sourceLineNo">3521</span> SerialUtilities.writePaint(this.baseSectionOutlinePaint, stream);<a name="line.3521"></a>
  3530. <span class="sourceLineNo">3522</span> SerialUtilities.writeStroke(this.sectionOutlineStroke, stream);<a name="line.3522"></a>
  3531. <span class="sourceLineNo">3523</span> SerialUtilities.writeStroke(this.baseSectionOutlineStroke, stream);<a name="line.3523"></a>
  3532. <span class="sourceLineNo">3524</span> SerialUtilities.writePaint(this.shadowPaint, stream);<a name="line.3524"></a>
  3533. <span class="sourceLineNo">3525</span> SerialUtilities.writePaint(this.labelPaint, stream);<a name="line.3525"></a>
  3534. <span class="sourceLineNo">3526</span> SerialUtilities.writePaint(this.labelBackgroundPaint, stream);<a name="line.3526"></a>
  3535. <span class="sourceLineNo">3527</span> SerialUtilities.writePaint(this.labelOutlinePaint, stream);<a name="line.3527"></a>
  3536. <span class="sourceLineNo">3528</span> SerialUtilities.writeStroke(this.labelOutlineStroke, stream);<a name="line.3528"></a>
  3537. <span class="sourceLineNo">3529</span> SerialUtilities.writePaint(this.labelShadowPaint, stream);<a name="line.3529"></a>
  3538. <span class="sourceLineNo">3530</span> SerialUtilities.writePaint(this.labelLinkPaint, stream);<a name="line.3530"></a>
  3539. <span class="sourceLineNo">3531</span> SerialUtilities.writeStroke(this.labelLinkStroke, stream);<a name="line.3531"></a>
  3540. <span class="sourceLineNo">3532</span> SerialUtilities.writeShape(this.legendItemShape, stream);<a name="line.3532"></a>
  3541. <span class="sourceLineNo">3533</span> }<a name="line.3533"></a>
  3542. <span class="sourceLineNo">3534</span><a name="line.3534"></a>
  3543. <span class="sourceLineNo">3535</span> /**<a name="line.3535"></a>
  3544. <span class="sourceLineNo">3536</span> * Provides serialization support.<a name="line.3536"></a>
  3545. <span class="sourceLineNo">3537</span> *<a name="line.3537"></a>
  3546. <span class="sourceLineNo">3538</span> * @param stream the input stream.<a name="line.3538"></a>
  3547. <span class="sourceLineNo">3539</span> *<a name="line.3539"></a>
  3548. <span class="sourceLineNo">3540</span> * @throws IOException if there is an I/O error.<a name="line.3540"></a>
  3549. <span class="sourceLineNo">3541</span> * @throws ClassNotFoundException if there is a classpath problem.<a name="line.3541"></a>
  3550. <span class="sourceLineNo">3542</span> */<a name="line.3542"></a>
  3551. <span class="sourceLineNo">3543</span> private void readObject(ObjectInputStream stream)<a name="line.3543"></a>
  3552. <span class="sourceLineNo">3544</span> throws IOException, ClassNotFoundException {<a name="line.3544"></a>
  3553. <span class="sourceLineNo">3545</span> stream.defaultReadObject();<a name="line.3545"></a>
  3554. <span class="sourceLineNo">3546</span> this.sectionPaint = SerialUtilities.readPaint(stream);<a name="line.3546"></a>
  3555. <span class="sourceLineNo">3547</span> this.baseSectionPaint = SerialUtilities.readPaint(stream);<a name="line.3547"></a>
  3556. <span class="sourceLineNo">3548</span> this.sectionOutlinePaint = SerialUtilities.readPaint(stream);<a name="line.3548"></a>
  3557. <span class="sourceLineNo">3549</span> this.baseSectionOutlinePaint = SerialUtilities.readPaint(stream);<a name="line.3549"></a>
  3558. <span class="sourceLineNo">3550</span> this.sectionOutlineStroke = SerialUtilities.readStroke(stream);<a name="line.3550"></a>
  3559. <span class="sourceLineNo">3551</span> this.baseSectionOutlineStroke = SerialUtilities.readStroke(stream);<a name="line.3551"></a>
  3560. <span class="sourceLineNo">3552</span> this.shadowPaint = SerialUtilities.readPaint(stream);<a name="line.3552"></a>
  3561. <span class="sourceLineNo">3553</span> this.labelPaint = SerialUtilities.readPaint(stream);<a name="line.3553"></a>
  3562. <span class="sourceLineNo">3554</span> this.labelBackgroundPaint = SerialUtilities.readPaint(stream);<a name="line.3554"></a>
  3563. <span class="sourceLineNo">3555</span> this.labelOutlinePaint = SerialUtilities.readPaint(stream);<a name="line.3555"></a>
  3564. <span class="sourceLineNo">3556</span> this.labelOutlineStroke = SerialUtilities.readStroke(stream);<a name="line.3556"></a>
  3565. <span class="sourceLineNo">3557</span> this.labelShadowPaint = SerialUtilities.readPaint(stream);<a name="line.3557"></a>
  3566. <span class="sourceLineNo">3558</span> this.labelLinkPaint = SerialUtilities.readPaint(stream);<a name="line.3558"></a>
  3567. <span class="sourceLineNo">3559</span> this.labelLinkStroke = SerialUtilities.readStroke(stream);<a name="line.3559"></a>
  3568. <span class="sourceLineNo">3560</span> this.legendItemShape = SerialUtilities.readShape(stream);<a name="line.3560"></a>
  3569. <span class="sourceLineNo">3561</span> }<a name="line.3561"></a>
  3570. <span class="sourceLineNo">3562</span><a name="line.3562"></a>
  3571. <span class="sourceLineNo">3563</span> // DEPRECATED FIELDS AND METHODS...<a name="line.3563"></a>
  3572. <span class="sourceLineNo">3564</span><a name="line.3564"></a>
  3573. <span class="sourceLineNo">3565</span> /**<a name="line.3565"></a>
  3574. <span class="sourceLineNo">3566</span> * The paint for ALL sections (overrides list).<a name="line.3566"></a>
  3575. <span class="sourceLineNo">3567</span> *<a name="line.3567"></a>
  3576. <span class="sourceLineNo">3568</span> * @deprecated This field is redundant, it is sufficient to use<a name="line.3568"></a>
  3577. <span class="sourceLineNo">3569</span> * sectionPaintMap and baseSectionPaint. Deprecated as of version<a name="line.3569"></a>
  3578. <span class="sourceLineNo">3570</span> * 1.0.6.<a name="line.3570"></a>
  3579. <span class="sourceLineNo">3571</span> */<a name="line.3571"></a>
  3580. <span class="sourceLineNo">3572</span> private transient Paint sectionPaint;<a name="line.3572"></a>
  3581. <span class="sourceLineNo">3573</span><a name="line.3573"></a>
  3582. <span class="sourceLineNo">3574</span> /**<a name="line.3574"></a>
  3583. <span class="sourceLineNo">3575</span> * The outline paint for ALL sections (overrides list).<a name="line.3575"></a>
  3584. <span class="sourceLineNo">3576</span> *<a name="line.3576"></a>
  3585. <span class="sourceLineNo">3577</span> * @deprecated This field is redundant, it is sufficient to use<a name="line.3577"></a>
  3586. <span class="sourceLineNo">3578</span> * sectionOutlinePaintMap and baseSectionOutlinePaint. Deprecated as<a name="line.3578"></a>
  3587. <span class="sourceLineNo">3579</span> * of version 1.0.6.<a name="line.3579"></a>
  3588. <span class="sourceLineNo">3580</span> */<a name="line.3580"></a>
  3589. <span class="sourceLineNo">3581</span> private transient Paint sectionOutlinePaint;<a name="line.3581"></a>
  3590. <span class="sourceLineNo">3582</span><a name="line.3582"></a>
  3591. <span class="sourceLineNo">3583</span> /**<a name="line.3583"></a>
  3592. <span class="sourceLineNo">3584</span> * The outline stroke for ALL sections (overrides list).<a name="line.3584"></a>
  3593. <span class="sourceLineNo">3585</span> *<a name="line.3585"></a>
  3594. <span class="sourceLineNo">3586</span> * @deprecated This field is redundant, it is sufficient to use<a name="line.3586"></a>
  3595. <span class="sourceLineNo">3587</span> * sectionOutlineStrokeMap and baseSectionOutlineStroke. Deprecated as<a name="line.3587"></a>
  3596. <span class="sourceLineNo">3588</span> * of version 1.0.6.<a name="line.3588"></a>
  3597. <span class="sourceLineNo">3589</span> */<a name="line.3589"></a>
  3598. <span class="sourceLineNo">3590</span> private transient Stroke sectionOutlineStroke;<a name="line.3590"></a>
  3599. <span class="sourceLineNo">3591</span><a name="line.3591"></a>
  3600. <span class="sourceLineNo">3592</span> /**<a name="line.3592"></a>
  3601. <span class="sourceLineNo">3593</span> * Returns the paint for the specified section.<a name="line.3593"></a>
  3602. <span class="sourceLineNo">3594</span> *<a name="line.3594"></a>
  3603. <span class="sourceLineNo">3595</span> * @param section the section index (zero-based).<a name="line.3595"></a>
  3604. <span class="sourceLineNo">3596</span> *<a name="line.3596"></a>
  3605. <span class="sourceLineNo">3597</span> * @return The paint (never &lt;code&gt;null&lt;/code&gt;).<a name="line.3597"></a>
  3606. <span class="sourceLineNo">3598</span> *<a name="line.3598"></a>
  3607. <span class="sourceLineNo">3599</span> * @deprecated Use {@link #getSectionPaint(Comparable)} instead.<a name="line.3599"></a>
  3608. <span class="sourceLineNo">3600</span> */<a name="line.3600"></a>
  3609. <span class="sourceLineNo">3601</span> public Paint getSectionPaint(int section) {<a name="line.3601"></a>
  3610. <span class="sourceLineNo">3602</span> Comparable key = getSectionKey(section);<a name="line.3602"></a>
  3611. <span class="sourceLineNo">3603</span> return getSectionPaint(key);<a name="line.3603"></a>
  3612. <span class="sourceLineNo">3604</span> }<a name="line.3604"></a>
  3613. <span class="sourceLineNo">3605</span><a name="line.3605"></a>
  3614. <span class="sourceLineNo">3606</span> /**<a name="line.3606"></a>
  3615. <span class="sourceLineNo">3607</span> * Sets the paint used to fill a section of the pie and sends a<a name="line.3607"></a>
  3616. <span class="sourceLineNo">3608</span> * {@link PlotChangeEvent} to all registered listeners.<a name="line.3608"></a>
  3617. <span class="sourceLineNo">3609</span> *<a name="line.3609"></a>
  3618. <span class="sourceLineNo">3610</span> * @param section the section index (zero-based).<a name="line.3610"></a>
  3619. <span class="sourceLineNo">3611</span> * @param paint the paint (&lt;code&gt;null&lt;/code&gt; permitted).<a name="line.3611"></a>
  3620. <span class="sourceLineNo">3612</span> *<a name="line.3612"></a>
  3621. <span class="sourceLineNo">3613</span> * @deprecated Use {@link #setSectionPaint(Comparable, Paint)} instead.<a name="line.3613"></a>
  3622. <span class="sourceLineNo">3614</span> */<a name="line.3614"></a>
  3623. <span class="sourceLineNo">3615</span> public void setSectionPaint(int section, Paint paint) {<a name="line.3615"></a>
  3624. <span class="sourceLineNo">3616</span> Comparable key = getSectionKey(section);<a name="line.3616"></a>
  3625. <span class="sourceLineNo">3617</span> setSectionPaint(key, paint);<a name="line.3617"></a>
  3626. <span class="sourceLineNo">3618</span> }<a name="line.3618"></a>
  3627. <span class="sourceLineNo">3619</span><a name="line.3619"></a>
  3628. <span class="sourceLineNo">3620</span> /**<a name="line.3620"></a>
  3629. <span class="sourceLineNo">3621</span> * Returns the outline paint for ALL sections in the plot.<a name="line.3621"></a>
  3630. <span class="sourceLineNo">3622</span> *<a name="line.3622"></a>
  3631. <span class="sourceLineNo">3623</span> * @return The paint (possibly &lt;code&gt;null&lt;/code&gt;).<a name="line.3623"></a>
  3632. <span class="sourceLineNo">3624</span> *<a name="line.3624"></a>
  3633. <span class="sourceLineNo">3625</span> * @see #setSectionOutlinePaint(Paint)<a name="line.3625"></a>
  3634. <span class="sourceLineNo">3626</span> *<a name="line.3626"></a>
  3635. <span class="sourceLineNo">3627</span> * @deprecated Use {@link #getSectionOutlinePaint(Comparable)} and<a name="line.3627"></a>
  3636. <span class="sourceLineNo">3628</span> * {@link #getBaseSectionOutlinePaint()}. Deprecated as of version<a name="line.3628"></a>
  3637. <span class="sourceLineNo">3629</span> * 1.0.6.<a name="line.3629"></a>
  3638. <span class="sourceLineNo">3630</span> */<a name="line.3630"></a>
  3639. <span class="sourceLineNo">3631</span> public Paint getSectionOutlinePaint() {<a name="line.3631"></a>
  3640. <span class="sourceLineNo">3632</span> return this.sectionOutlinePaint;<a name="line.3632"></a>
  3641. <span class="sourceLineNo">3633</span> }<a name="line.3633"></a>
  3642. <span class="sourceLineNo">3634</span><a name="line.3634"></a>
  3643. <span class="sourceLineNo">3635</span> /**<a name="line.3635"></a>
  3644. <span class="sourceLineNo">3636</span> * Sets the outline paint for ALL sections in the plot. If this is set to<a name="line.3636"></a>
  3645. <span class="sourceLineNo">3637</span> * {@code null}, then a list of paints is used instead (to allow<a name="line.3637"></a>
  3646. <span class="sourceLineNo">3638</span> * different colors to be used for each section).<a name="line.3638"></a>
  3647. <span class="sourceLineNo">3639</span> *<a name="line.3639"></a>
  3648. <span class="sourceLineNo">3640</span> * @param paint the paint (&lt;code&gt;null&lt;/code&gt; permitted).<a name="line.3640"></a>
  3649. <span class="sourceLineNo">3641</span> *<a name="line.3641"></a>
  3650. <span class="sourceLineNo">3642</span> * @see #getSectionOutlinePaint()<a name="line.3642"></a>
  3651. <span class="sourceLineNo">3643</span> *<a name="line.3643"></a>
  3652. <span class="sourceLineNo">3644</span> * @deprecated Use {@link #setSectionOutlinePaint(Comparable, Paint)} and<a name="line.3644"></a>
  3653. <span class="sourceLineNo">3645</span> * {@link #setBaseSectionOutlinePaint(Paint)}. Deprecated as of<a name="line.3645"></a>
  3654. <span class="sourceLineNo">3646</span> * version 1.0.6.<a name="line.3646"></a>
  3655. <span class="sourceLineNo">3647</span> */<a name="line.3647"></a>
  3656. <span class="sourceLineNo">3648</span> public void setSectionOutlinePaint(Paint paint) {<a name="line.3648"></a>
  3657. <span class="sourceLineNo">3649</span> this.sectionOutlinePaint = paint;<a name="line.3649"></a>
  3658. <span class="sourceLineNo">3650</span> fireChangeEvent();<a name="line.3650"></a>
  3659. <span class="sourceLineNo">3651</span> }<a name="line.3651"></a>
  3660. <span class="sourceLineNo">3652</span><a name="line.3652"></a>
  3661. <span class="sourceLineNo">3653</span> /**<a name="line.3653"></a>
  3662. <span class="sourceLineNo">3654</span> * Returns the paint for the specified section.<a name="line.3654"></a>
  3663. <span class="sourceLineNo">3655</span> *<a name="line.3655"></a>
  3664. <span class="sourceLineNo">3656</span> * @param section the section index (zero-based).<a name="line.3656"></a>
  3665. <span class="sourceLineNo">3657</span> *<a name="line.3657"></a>
  3666. <span class="sourceLineNo">3658</span> * @return The paint (possibly &lt;code&gt;null&lt;/code&gt;).<a name="line.3658"></a>
  3667. <span class="sourceLineNo">3659</span> *<a name="line.3659"></a>
  3668. <span class="sourceLineNo">3660</span> * @deprecated Use {@link #getSectionOutlinePaint(Comparable)} instead.<a name="line.3660"></a>
  3669. <span class="sourceLineNo">3661</span> */<a name="line.3661"></a>
  3670. <span class="sourceLineNo">3662</span> public Paint getSectionOutlinePaint(int section) {<a name="line.3662"></a>
  3671. <span class="sourceLineNo">3663</span> Comparable key = getSectionKey(section);<a name="line.3663"></a>
  3672. <span class="sourceLineNo">3664</span> return getSectionOutlinePaint(key);<a name="line.3664"></a>
  3673. <span class="sourceLineNo">3665</span> }<a name="line.3665"></a>
  3674. <span class="sourceLineNo">3666</span><a name="line.3666"></a>
  3675. <span class="sourceLineNo">3667</span> /**<a name="line.3667"></a>
  3676. <span class="sourceLineNo">3668</span> * Sets the paint used to fill a section of the pie and sends a<a name="line.3668"></a>
  3677. <span class="sourceLineNo">3669</span> * {@link PlotChangeEvent} to all registered listeners.<a name="line.3669"></a>
  3678. <span class="sourceLineNo">3670</span> *<a name="line.3670"></a>
  3679. <span class="sourceLineNo">3671</span> * @param section the section index (zero-based).<a name="line.3671"></a>
  3680. <span class="sourceLineNo">3672</span> * @param paint the paint (&lt;code&gt;null&lt;/code&gt; permitted).<a name="line.3672"></a>
  3681. <span class="sourceLineNo">3673</span> *<a name="line.3673"></a>
  3682. <span class="sourceLineNo">3674</span> * @deprecated Use {@link #setSectionOutlinePaint(Comparable, Paint)}<a name="line.3674"></a>
  3683. <span class="sourceLineNo">3675</span> * instead.<a name="line.3675"></a>
  3684. <span class="sourceLineNo">3676</span> */<a name="line.3676"></a>
  3685. <span class="sourceLineNo">3677</span> public void setSectionOutlinePaint(int section, Paint paint) {<a name="line.3677"></a>
  3686. <span class="sourceLineNo">3678</span> Comparable key = getSectionKey(section);<a name="line.3678"></a>
  3687. <span class="sourceLineNo">3679</span> setSectionOutlinePaint(key, paint);<a name="line.3679"></a>
  3688. <span class="sourceLineNo">3680</span> }<a name="line.3680"></a>
  3689. <span class="sourceLineNo">3681</span><a name="line.3681"></a>
  3690. <span class="sourceLineNo">3682</span> /**<a name="line.3682"></a>
  3691. <span class="sourceLineNo">3683</span> * Returns the outline stroke for ALL sections in the plot.<a name="line.3683"></a>
  3692. <span class="sourceLineNo">3684</span> *<a name="line.3684"></a>
  3693. <span class="sourceLineNo">3685</span> * @return The stroke (possibly &lt;code&gt;null&lt;/code&gt;).<a name="line.3685"></a>
  3694. <span class="sourceLineNo">3686</span> *<a name="line.3686"></a>
  3695. <span class="sourceLineNo">3687</span> * @see #setSectionOutlineStroke(Stroke)<a name="line.3687"></a>
  3696. <span class="sourceLineNo">3688</span> *<a name="line.3688"></a>
  3697. <span class="sourceLineNo">3689</span> * @deprecated Use {@link #getSectionOutlineStroke(Comparable)} and<a name="line.3689"></a>
  3698. <span class="sourceLineNo">3690</span> * {@link #getBaseSectionOutlineStroke()}. Deprecated as of version<a name="line.3690"></a>
  3699. <span class="sourceLineNo">3691</span> * 1.0.6.<a name="line.3691"></a>
  3700. <span class="sourceLineNo">3692</span> */<a name="line.3692"></a>
  3701. <span class="sourceLineNo">3693</span> public Stroke getSectionOutlineStroke() {<a name="line.3693"></a>
  3702. <span class="sourceLineNo">3694</span> return this.sectionOutlineStroke;<a name="line.3694"></a>
  3703. <span class="sourceLineNo">3695</span> }<a name="line.3695"></a>
  3704. <span class="sourceLineNo">3696</span><a name="line.3696"></a>
  3705. <span class="sourceLineNo">3697</span> /**<a name="line.3697"></a>
  3706. <span class="sourceLineNo">3698</span> * Sets the outline stroke for ALL sections in the plot. If this is set to<a name="line.3698"></a>
  3707. <span class="sourceLineNo">3699</span> * {@code null}, then a list of paints is used instead (to allow<a name="line.3699"></a>
  3708. <span class="sourceLineNo">3700</span> * different colors to be used for each section).<a name="line.3700"></a>
  3709. <span class="sourceLineNo">3701</span> *<a name="line.3701"></a>
  3710. <span class="sourceLineNo">3702</span> * @param stroke the stroke (&lt;code&gt;null&lt;/code&gt; permitted).<a name="line.3702"></a>
  3711. <span class="sourceLineNo">3703</span> *<a name="line.3703"></a>
  3712. <span class="sourceLineNo">3704</span> * @see #getSectionOutlineStroke()<a name="line.3704"></a>
  3713. <span class="sourceLineNo">3705</span> *<a name="line.3705"></a>
  3714. <span class="sourceLineNo">3706</span> * @deprecated Use {@link #setSectionOutlineStroke(Comparable, Stroke)} and<a name="line.3706"></a>
  3715. <span class="sourceLineNo">3707</span> * {@link #setBaseSectionOutlineStroke(Stroke)}. Deprecated as of<a name="line.3707"></a>
  3716. <span class="sourceLineNo">3708</span> * version 1.0.6.<a name="line.3708"></a>
  3717. <span class="sourceLineNo">3709</span> */<a name="line.3709"></a>
  3718. <span class="sourceLineNo">3710</span> public void setSectionOutlineStroke(Stroke stroke) {<a name="line.3710"></a>
  3719. <span class="sourceLineNo">3711</span> this.sectionOutlineStroke = stroke;<a name="line.3711"></a>
  3720. <span class="sourceLineNo">3712</span> fireChangeEvent();<a name="line.3712"></a>
  3721. <span class="sourceLineNo">3713</span> }<a name="line.3713"></a>
  3722. <span class="sourceLineNo">3714</span><a name="line.3714"></a>
  3723. <span class="sourceLineNo">3715</span> /**<a name="line.3715"></a>
  3724. <span class="sourceLineNo">3716</span> * Returns the stroke for the specified section.<a name="line.3716"></a>
  3725. <span class="sourceLineNo">3717</span> *<a name="line.3717"></a>
  3726. <span class="sourceLineNo">3718</span> * @param section the section index (zero-based).<a name="line.3718"></a>
  3727. <span class="sourceLineNo">3719</span> *<a name="line.3719"></a>
  3728. <span class="sourceLineNo">3720</span> * @return The stroke (possibly &lt;code&gt;null&lt;/code&gt;).<a name="line.3720"></a>
  3729. <span class="sourceLineNo">3721</span> *<a name="line.3721"></a>
  3730. <span class="sourceLineNo">3722</span> * @deprecated Use {@link #getSectionOutlineStroke(Comparable)} instead.<a name="line.3722"></a>
  3731. <span class="sourceLineNo">3723</span> */<a name="line.3723"></a>
  3732. <span class="sourceLineNo">3724</span> public Stroke getSectionOutlineStroke(int section) {<a name="line.3724"></a>
  3733. <span class="sourceLineNo">3725</span> Comparable key = getSectionKey(section);<a name="line.3725"></a>
  3734. <span class="sourceLineNo">3726</span> return getSectionOutlineStroke(key);<a name="line.3726"></a>
  3735. <span class="sourceLineNo">3727</span> }<a name="line.3727"></a>
  3736. <span class="sourceLineNo">3728</span><a name="line.3728"></a>
  3737. <span class="sourceLineNo">3729</span> /**<a name="line.3729"></a>
  3738. <span class="sourceLineNo">3730</span> * Sets the stroke used to fill a section of the pie and sends a<a name="line.3730"></a>
  3739. <span class="sourceLineNo">3731</span> * {@link PlotChangeEvent} to all registered listeners.<a name="line.3731"></a>
  3740. <span class="sourceLineNo">3732</span> *<a name="line.3732"></a>
  3741. <span class="sourceLineNo">3733</span> * @param section the section index (zero-based).<a name="line.3733"></a>
  3742. <span class="sourceLineNo">3734</span> * @param stroke the stroke (&lt;code&gt;null&lt;/code&gt; permitted).<a name="line.3734"></a>
  3743. <span class="sourceLineNo">3735</span> *<a name="line.3735"></a>
  3744. <span class="sourceLineNo">3736</span> * @deprecated Use {@link #setSectionOutlineStroke(Comparable, Stroke)}<a name="line.3736"></a>
  3745. <span class="sourceLineNo">3737</span> * instead.<a name="line.3737"></a>
  3746. <span class="sourceLineNo">3738</span> */<a name="line.3738"></a>
  3747. <span class="sourceLineNo">3739</span> public void setSectionOutlineStroke(int section, Stroke stroke) {<a name="line.3739"></a>
  3748. <span class="sourceLineNo">3740</span> Comparable key = getSectionKey(section);<a name="line.3740"></a>
  3749. <span class="sourceLineNo">3741</span> setSectionOutlineStroke(key, stroke);<a name="line.3741"></a>
  3750. <span class="sourceLineNo">3742</span> }<a name="line.3742"></a>
  3751. <span class="sourceLineNo">3743</span><a name="line.3743"></a>
  3752. <span class="sourceLineNo">3744</span> /**<a name="line.3744"></a>
  3753. <span class="sourceLineNo">3745</span> * Returns the amount that a section should be 'exploded'.<a name="line.3745"></a>
  3754. <span class="sourceLineNo">3746</span> *<a name="line.3746"></a>
  3755. <span class="sourceLineNo">3747</span> * @param section the section number.<a name="line.3747"></a>
  3756. <span class="sourceLineNo">3748</span> *<a name="line.3748"></a>
  3757. <span class="sourceLineNo">3749</span> * @return The amount that a section should be 'exploded'.<a name="line.3749"></a>
  3758. <span class="sourceLineNo">3750</span> *<a name="line.3750"></a>
  3759. <span class="sourceLineNo">3751</span> * @deprecated Use {@link #getExplodePercent(Comparable)} instead.<a name="line.3751"></a>
  3760. <span class="sourceLineNo">3752</span> */<a name="line.3752"></a>
  3761. <span class="sourceLineNo">3753</span> public double getExplodePercent(int section) {<a name="line.3753"></a>
  3762. <span class="sourceLineNo">3754</span> Comparable key = getSectionKey(section);<a name="line.3754"></a>
  3763. <span class="sourceLineNo">3755</span> return getExplodePercent(key);<a name="line.3755"></a>
  3764. <span class="sourceLineNo">3756</span> }<a name="line.3756"></a>
  3765. <span class="sourceLineNo">3757</span><a name="line.3757"></a>
  3766. <span class="sourceLineNo">3758</span> /**<a name="line.3758"></a>
  3767. <span class="sourceLineNo">3759</span> * Sets the amount that a pie section should be exploded and sends a<a name="line.3759"></a>
  3768. <span class="sourceLineNo">3760</span> * {@link PlotChangeEvent} to all registered listeners.<a name="line.3760"></a>
  3769. <span class="sourceLineNo">3761</span> *<a name="line.3761"></a>
  3770. <span class="sourceLineNo">3762</span> * @param section the section index.<a name="line.3762"></a>
  3771. <span class="sourceLineNo">3763</span> * @param percent the explode percentage (0.30 = 30 percent).<a name="line.3763"></a>
  3772. <span class="sourceLineNo">3764</span> *<a name="line.3764"></a>
  3773. <span class="sourceLineNo">3765</span> * @deprecated Use {@link #setExplodePercent(Comparable, double)} instead.<a name="line.3765"></a>
  3774. <span class="sourceLineNo">3766</span> */<a name="line.3766"></a>
  3775. <span class="sourceLineNo">3767</span> public void setExplodePercent(int section, double percent) {<a name="line.3767"></a>
  3776. <span class="sourceLineNo">3768</span> Comparable key = getSectionKey(section);<a name="line.3768"></a>
  3777. <span class="sourceLineNo">3769</span> setExplodePercent(key, percent);<a name="line.3769"></a>
  3778. <span class="sourceLineNo">3770</span> }<a name="line.3770"></a>
  3779. <span class="sourceLineNo">3771</span><a name="line.3771"></a>
  3780. <span class="sourceLineNo">3772</span>}<a name="line.3772"></a>
  3781. </pre>
  3782. </div>
  3783. </body>
  3784. </html>