kcp_lorenz.html 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Lorenz Curves</title>
  5. <link class="include" rel="stylesheet" type="text/css" href="../jquery.jqplot.min.css" />
  6. <link rel="stylesheet" type="text/css" href="examples.min.css" />
  7. <link type="text/css" rel="stylesheet" href="syntaxhighlighter/styles/shCoreDefault.min.css" />
  8. <link type="text/css" rel="stylesheet" href="syntaxhighlighter/styles/shThemejqPlot.min.css" />
  9. <!--[if lt IE 9]><script language="javascript" type="text/javascript" src="../excanvas.js"></script><![endif]-->
  10. <script class="include" type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
  11. </head>
  12. <body>
  13. <div id="header">
  14. <div class="nav">
  15. <a class="nav" href="../../../index.php"><span>&gt;</span>Home</a>
  16. <a class="nav" href="../../../docs/"><span>&gt;</span>Docs</a>
  17. <a class="nav" href="../../download/"><span>&gt;</span>Download</a>
  18. <a class="nav" href="../../../info.php"><span>&gt;</span>Info</a>
  19. <a class="nav" href="../../../donate.php"><span>&gt;</span>Donate</a>
  20. </div>
  21. </div>
  22. <div class="colmask leftmenu">
  23. <div class="colleft">
  24. <div class="col1" id="example-content">
  25. <!-- Example scripts go here -->
  26. <link class="include" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.0/themes/smoothness/jquery-ui.csss" rel="Stylesheet" />
  27. <style type="text/css">
  28. .chart-container {
  29. border: 1px solid darkblue;
  30. padding: 30px;
  31. width: 500px;
  32. height: 400px;
  33. }
  34. #chart1 {
  35. width: 96%;
  36. height: 96%;
  37. }
  38. .jqplot-datestamp {
  39. font-size: 0.8em;
  40. color: #777;
  41. /* margin-top: 1em;
  42. text-align: right;*/
  43. font-style: italic;
  44. position: absolute;
  45. bottom: 15px;
  46. right: 15px;
  47. }
  48. td.controls li {
  49. list-style-type: none;
  50. }
  51. td.controls ul {
  52. margin-top: 0.5em;
  53. padding-left: 0.2em;
  54. }
  55. pre.code {
  56. margin-top: 45px;
  57. clear: both;
  58. }
  59. </style>
  60. <table class="app">
  61. <td class="controls">
  62. <div>
  63. Data Series:
  64. <ul>
  65. <li><input class="dataSeries-checkbox" name="dataSeries_national" value="national" type="checkbox" checked />National</li>
  66. <li><input class="dataSeries-checkbox" name="dataSeries_urban" value="urban" type="checkbox" />Urban</li>
  67. <li><input class="dataSeries-checkbox" name="dataSeries_rural" value="rural" type="checkbox" />Rural</li>
  68. </ul>
  69. </div>
  70. <div>
  71. Background Color:
  72. <ul>
  73. <li><input name="backgroundColor" value="white" type="radio" checked />Default</li>
  74. <li><input name="backgroundColor" value="#efefef" type="radio" />Gray</li>
  75. </ul>
  76. </div>
  77. <div>
  78. Line Width:
  79. <ul>
  80. <li><input name="lineWidth" value="2.5" type="radio" checked />Thin</li>
  81. <li><input name="lineWidth" value="5" type="radio" />Thick</li>
  82. </ul>
  83. </div>
  84. <div>
  85. Grids:
  86. <ul>
  87. <li><input name="gridsVertical" value="vertical" type="checkbox" checked />Vertical</li>
  88. <li><input name="gridsHorizontal" value="horizontal" type="checkbox" checked />Horizontal</li>
  89. </ul>
  90. </div>
  91. <div>
  92. Cutoff Lines:
  93. <ul>
  94. <li><input name="cutoffLines" value="showCutoffLines" type="checkbox" checked />Show</li>
  95. <li>Low:&nbsp;&nbsp;<input name="userLine1" value="42" type="text" size="6" /></li>
  96. <li>High:&nbsp;<input name="userLine2" value="75" type="text" size="6" /></li>
  97. </ul>
  98. </div>
  99. </td>
  100. <td class="chart">
  101. <div class="chart-container">
  102. <div id="chart1"></div>
  103. <div class="jqplot-datestamp"></div>
  104. </div>
  105. </td>
  106. </table>
  107. <pre class="code brush:js"></pre>
  108. <script class="code" type="text/javascript">
  109. $(document).ready(function(){
  110. var dataSets = {
  111. national: [[0, 0], [0.034259, 0.000122], [0.036908, 0.000271], [0.039957, 0.000457], [0.043623, 0.000699], [0.048008, 0.001005], [0.053278, 0.001404], [0.059665, 0.001916], [0.067405, 0.002587], [0.076951, 0.003482], [0.088909, 0.004676], [0.103706, 0.006234], [0.121406, 0.008198], [0.142376, 0.010698], [0.167456, 0.013945], [0.198392, 0.018266], [0.237371, 0.024152], [0.287096, 0.03217], [0.350664, 0.043128], [0.43322, 0.058856], [0.546538, 0.08196], [0.703419, 0.116382], [0.921534, 0.167573], [1.225405, 0.244101], [1.658248, 0.362099], [2.286919, 0.545089], [3.168531, 0.811148], [4.338121, 1.180312], [5.828025, 1.677699], [7.674282, 2.317937], [9.856185, 3.124879], [12.427952, 4.135038], [15.374906, 5.337835], [18.559853, 6.704187], [21.938501, 8.240167], [25.480211, 9.968066], [29.195872, 11.896316], [33.040813, 13.995922], [36.929108, 16.268393], [40.883239, 18.753271], [44.934876, 21.456742], [48.979949, 24.281483], [52.874709, 27.163823], [56.569122, 30.090586], [60.143349, 33.155912], [63.632698, 36.332609], [67.019887, 39.647977], [70.272329, 42.982924], [73.31569, 46.301522], [76.137996, 49.580067], [78.734309, 52.80729], [81.144203, 56.013671], [83.364771, 59.154237], [85.40072, 62.237023], [87.276365, 65.274088], [88.994984, 68.231226], [90.547773, 71.063226], [91.930153, 73.740825], [93.143588, 76.235257], [94.19365, 78.526502], [95.093093, 80.626967], [95.863261, 82.534767], [96.518119, 84.276606], [97.07861, 85.871008], [97.555507, 87.313822], [97.958887, 88.612275], [98.29631, 89.76839], [98.57645, 90.788966], [98.805892, 91.680096], [98.994988, 92.471419], [99.15183, 93.168954], [99.279882, 93.771844], [99.384116, 94.303287], [99.470272, 94.773123], [99.541871, 95.191639], [99.601871, 95.572501], [99.653556, 95.924822], [99.698334, 96.25129], [99.737113, 96.553878], [99.770733, 96.834228], [99.800151, 97.099569], [99.826487, 97.355328], [99.85018, 97.600349], [99.871291, 97.832168], [99.889939, 98.050737], [99.906286, 98.254414], [99.92045, 98.442305], [99.932702, 98.616245], [99.9433, 98.776877], [99.952485, 98.926517], [99.960528, 99.066855], [99.96755, 99.196967], [99.9736, 99.316087], [99.978742, 99.423943], [99.983126, 99.523155], [99.986929, 99.615949], [99.990275, 99.703425], [99.993221, 99.785398], [99.995794, 99.861721], [99.998031, 99.932812], [100, 100]],
  112. urban: [[0, 0], [0.022476, 0.000211], [0.026364, 0.000483], [0.031079, 0.000832], [0.03683, 0.001286], [0.043812, 0.001867], [0.052123, 0.002596], [0.061977, 0.003523], [0.07392, 0.00472], [0.08836, 0.006245], [0.105627, 0.008192], [0.126649, 0.010745], [0.152991, 0.014185], [0.186685, 0.01887], [0.230466, 0.025421], [0.288337, 0.034602], [0.364009, 0.047302], [0.462362, 0.064833], [0.591815, 0.0896], [0.763717, 0.124292], [0.990265, 0.173076], [1.291577, 0.242086], [1.689361, 0.337485], [2.197829, 0.465168], [2.833156, 0.632983], [3.607935, 0.847553], [4.531058, 1.117227], [5.612064, 1.448077], [6.829389, 1.832426], [8.150496, 2.276607], [9.587093, 2.787319], [11.139531, 3.375891], [12.843232, 4.068491], [14.744, 4.894875], [16.882944, 5.879821], [19.274088, 7.043989], [21.898373, 8.377077], [24.70402, 9.889069], [27.725078, 11.639484], [31.02485, 13.647365], [34.577391, 15.957918], [38.361881, 18.496115], [42.220399, 21.242326], [46.204947, 24.281703], [50.279452, 27.501128], [54.284933, 30.800251], [58.020934, 34.003512], [61.527083, 37.314968], [65.059633, 40.928214], [68.631977, 44.751812], [72.134933, 48.615769], [75.35901, 52.332308], [78.289798, 55.927374], [80.980675, 59.439449], [83.426691, 62.80086], [85.63051, 66.024375], [87.600439, 69.040545], [89.324337, 71.839628], [90.82494, 74.405703], [92.132382, 76.808559], [93.28344, 79.051197], [94.291515, 81.128944], [95.165628, 83.025406], [95.917569, 84.765777], [96.566309, 86.346045], [97.111687, 87.728898], [97.557321, 88.935715], [97.923776, 89.98232], [98.224115, 90.896808], [98.472073, 91.712405], [98.683427, 92.454973], [98.864412, 93.127257], [99.018636, 93.73762], [99.150765, 94.298112], [99.266909, 94.826197], [99.369967, 95.321988], [99.460335, 95.779249], [99.538693, 96.200706], [99.60658, 96.587402], [99.665149, 96.942925], [99.716006, 97.27086], [99.76009, 97.572073], [99.798168, 97.847633], [99.830962, 98.099393], [99.858805, 98.322381], [99.881656, 98.513678], [99.900176, 98.68098], [99.91564, 98.83196], [99.928971, 98.970904], [99.940546, 99.098968], [99.950572, 99.216266], [99.959091, 99.321169], [99.966315, 99.415471], [99.97239, 99.500041], [99.97761, 99.578707], [99.982252, 99.653757], [99.986425, 99.725788], [99.990223, 99.796075], [99.993742, 99.865362], [99.996997, 99.933105], [100, 100]],
  113. rural: [[0, 0], [0.044856, 0.00021], [0.048153, 0.000449], [0.051764, 0.000737], [0.055907, 0.001092], [0.060801, 0.00155], [0.066762, 0.002138], [0.073899, 0.002894], [0.082612, 0.003876], [0.093168, 0.005148], [0.106164, 0.006835], [0.122508, 0.009095], [0.142886, 0.012069], [0.16758, 0.015833], [0.19669, 0.020566], [0.23118, 0.026579], [0.273098, 0.034447], [0.325019, 0.044958], [0.390807, 0.059161], [0.474177, 0.078318], [0.579565, 0.104359], [0.719638, 0.14226], [0.911325, 0.197784], [1.175054, 0.278915], [1.537895, 0.397967], [2.041596, 0.57646], [2.758826, 0.848809], [3.776691, 1.250019], [5.133703, 1.8048], [6.852621, 2.537016], [8.948744, 3.478047], [11.417648, 4.640509], [14.293846, 6.085098], [17.634387, 7.851123], [21.360828, 9.886831], [25.29956, 12.160142], [29.428878, 14.674388], [33.707138, 17.452533], [38.129755, 20.506174], [42.671778, 23.796002], [47.229102, 27.303349], [51.800588, 31.060857], [56.383771, 35.053496], [60.886558, 39.145526], [65.12792, 43.181575], [69.030354, 47.116849], [72.617033, 51.025646], [75.986887, 54.923636], [79.112304, 58.743632], [81.975561, 62.443223], [84.537139, 65.922443], [86.782817, 69.135506], [88.71901, 72.103335], [90.413815, 74.878966], [91.908817, 77.500639], [93.228911, 79.953304], [94.381653, 82.20716], [95.359352, 84.209133], [96.170082, 85.973719], [96.837248, 87.5051], [97.378991, 88.838761], [97.8273, 90.020506], [98.200135, 91.065991], [98.506646, 91.96714], [98.752685, 92.735267], [98.949784, 93.390185], [99.10766, 93.94721], [99.232528, 94.417506], [99.334335, 94.838423], [99.42121, 95.226477], [99.497035, 95.589049], [99.563629, 95.927413], [99.621726, 96.240868], [99.672192, 96.530566], [99.715746, 96.794464], [99.752893, 97.034788], [99.784601, 97.251679], [99.811139, 97.442528], [99.833203, 97.614678], [99.852181, 97.774104], [99.868723, 97.92227], [99.883153, 98.05955], [99.89576, 98.188276], [99.906951, 98.310902], [99.917064, 98.429897], [99.926265, 98.545001], [99.9346, 98.656238], [99.942191, 98.76409], [99.949086, 98.868769], [99.955426, 98.971691], [99.961279, 99.072938], [99.966677, 99.172455], [99.971673, 99.270765], [99.976302, 99.367541], [99.980575, 99.462525], [99.984496, 99.554946], [99.988063, 99.644199], [99.991314, 99.731953], [99.994366, 99.820708], [99.997264, 99.910225], [100, 100]]
  114. }
  115. // Initial values for the user lines.
  116. var userLine1Val = 42;
  117. var userLine2Val = 75;
  118. // find the index of the data point with the closest y value.
  119. // assumes y values are monotonically increasing.
  120. var findXValue = function (y, data) {
  121. var l = data.length;
  122. var temp;
  123. var d;
  124. var idx;
  125. var mid = Math.round(l/2);
  126. var interval = mid;
  127. var prevInterval = mid;
  128. var dist = null;
  129. var absDist = null;
  130. var hold = null;
  131. var ret = null;
  132. var x, x0, x1, y0, y1, lowidx, hiidx;
  133. // check to see if we're in range
  134. if (y > data[l-1][1]) {
  135. return [l-1, data[l-1]];
  136. }
  137. else if (y < data[0][1]) {
  138. return [0, data[0]];
  139. }
  140. for (var i=0; i<l; i++) {
  141. d = data[mid][1];
  142. dist = d - y;
  143. absDist = Math.abs(dist);
  144. interval = Math.round(interval/2);
  145. if (absDist < hold || hold === null) {
  146. hold = absDist;
  147. idx = mid;
  148. }
  149. // if we're right on the pont, get out of here
  150. if (dist === 0) {
  151. ret = [idx, data[idx]];
  152. break;
  153. }
  154. // if we've narrowed it down to an interval,
  155. // interpolate and get out of here
  156. else if (prevInterval === 1) {
  157. // to the right, interpolate -1 to here
  158. if (dist > 0) {
  159. lowidx = idx - 1;
  160. hiidx = idx;
  161. }
  162. else {
  163. lowidx = idx;
  164. hiidx = idx + 1;
  165. }
  166. x0 = data[lowidx][0];
  167. x1 = data[hiidx][0];
  168. y0 = data[lowidx][1];
  169. y1 = data[hiidx][1];
  170. x = x0 + (y - y0) / (y1 - y0) * (x1 - x0);
  171. ret = [idx, [x, y]];
  172. break;
  173. }
  174. // to the right, go left and reduce
  175. else if (dist > 0) {
  176. mid -= interval;
  177. }
  178. // to the left go right and increase
  179. else if (dist < 0) {
  180. mid += interval;
  181. }
  182. prevInterval = interval;
  183. }
  184. return ret;
  185. }
  186. // determine initial values for horizontal and vertical overlay lines.
  187. var line1x = findXValue(userLine1Val, dataSets.national)[1][0];
  188. var line2x = findXValue(userLine2Val, dataSets.national)[1][0];;
  189. var line3y = userLine1Val;
  190. var line4y = userLine2Val;
  191. // make the plot
  192. plot1 = $.jqplot("chart1", [dataSets.national, dataSets.urban, dataSets.rural], {
  193. title: "Lorenz Curve",
  194. // To control the size of the grid, can set the gridPadding option,
  195. // gridPadding: {top: 40, bottom: 60, left: 70, right: 50},
  196. // but must know size of container ahead of time and figure out what paddings
  197. // you want to get a square grid.
  198. // Alternatively, can use the gridDimensions option.
  199. // gridDimensions doesn't get reapplied on replot() because plots
  200. // _gridPadding attribute is set the first time it is drawn and it
  201. // won't be overwritten.
  202. gridDimensions: {height: 290, width: 290},
  203. seriesColors: ["#4bb2c5", "#c54b62", "#b2c54b"],
  204. cursor: {
  205. show: false
  206. },
  207. highlighter: {
  208. show: true,
  209. showMarker: false,
  210. useAxesFormatters: false,
  211. formatString: '%d, %.1f'
  212. },
  213. axesDefaults: {
  214. labelRenderer: $.jqplot.CanvasAxisLabelRenderer
  215. },
  216. seriesDefaults: {
  217. showMarker: false
  218. },
  219. series: [
  220. {show: true},
  221. {show: false},
  222. {show: false}
  223. ],
  224. axes: {
  225. xaxis: {
  226. label: '% of Population',
  227. pad:0
  228. },
  229. yaxis: {
  230. label: '% of Expenditure',
  231. pad: 0
  232. }
  233. },
  234. grid: {
  235. drawBorder: false,
  236. shadow: false,
  237. // background: 'rgba(0,0,0,0)' works.
  238. background: "white"
  239. },
  240. canvasOverlay: {
  241. show: true,
  242. objects: [,
  243. {line: {
  244. name: "line5",
  245. start: [0,0],
  246. stop: [100,100],
  247. color: "#666666",
  248. shadow: false,
  249. showTooltip: false,
  250. lineWidth: 3
  251. }},
  252. {horizontalLine: {
  253. name: "line1",
  254. y: userLine1Val,
  255. color: "#d4c35D",
  256. xmin: 0,
  257. xmax: line1x,
  258. shadow: false,
  259. showTooltip: true,
  260. tooltipFormatString: "%nPS=%'d",
  261. showTooltipPrecision: 0.5
  262. }},
  263. {horizontalLine: {
  264. name: "line2",
  265. y: userLine2Val,
  266. color: "#d4c35D",
  267. xmin: 0,
  268. xmax: line2x,
  269. shadow: false,
  270. showTooltip: true,
  271. tooltipFormatString: "%nPS=%'d",
  272. showTooltipPrecision: 0.5
  273. }},
  274. {verticalLine: {
  275. name: "line3",
  276. x: line1x,
  277. color: "#d4c35D",
  278. ymin: 0,
  279. ymax: line3y,
  280. shadow: false,
  281. showTooltip: true,
  282. tooltipFormatString: "PCE=%'d",
  283. showTooltipPrecision: 0.5
  284. }},
  285. {verticalLine: {
  286. name: "line4",
  287. x: line2x,
  288. color: "#d4c35D",
  289. ymin: 0,
  290. ymax: line4y,
  291. shadow: false,
  292. showTooltip: true,
  293. tooltipFormatString: "PCE=%'d",
  294. showTooltipPrecision: 0.5
  295. }}
  296. ]
  297. }
  298. });
  299. // add a date at the bottom.
  300. var d = new $.jsDate();
  301. $("div.jqplot-datestamp").html("Generated on "+d.strftime("%v"));
  302. // initialize form elements
  303. // set these before attaching event handlers.
  304. $("input.dataSeries-checkbox").attr("checked", false);
  305. $("input.dataSeries-checkbox[name=dataSeries_national]").attr("checked", true);
  306. $("input[type=radio][name=backgroundColor]").attr("checked", false);
  307. $("input[type=radio][name=backgroundColor][value=white]").attr("checked", true);
  308. $("input[type=radio][name=lineWidth]").attr("checked", false);
  309. $('input[type=radio][name=lineWidth][value="2.5"]').attr("checked", true);
  310. $("input[type=text][name=userLine1]").val(userLine1Val);
  311. $("input[type=text][name=userLine2]").val(userLine2Val);
  312. $("input[type=checkbox][name=gridsVertical]").attr("checked", true);
  313. $("input[type=checkbox][name=gridsHorizontal]").attr("checked", true);
  314. $("input[type=checkbox][name=cutoffLines]").attr("checked", true);
  315. // attach event handlers to form elements
  316. $("input[type=radio][name=backgroundColor]").change(function(){
  317. plot1.grid.background = $(this).val();
  318. plot1.replot();
  319. });
  320. $("input.dataSeries-checkbox").change(function(){
  321. plot1.series[0].show = false;
  322. plot1.series[1].show = false;
  323. plot1.series[2].show = false;
  324. if ($('input[name=dataSeries_national]').get(0).checked === true) {
  325. plot1.series[0].show = true;
  326. }
  327. if ($('input[name=dataSeries_urban]').get(0).checked === true) {
  328. plot1.series[1].show = true;
  329. }
  330. if ($('input[name=dataSeries_rural]').get(0).checked === true) {
  331. plot1.series[2].show = true;
  332. }
  333. // var co = plot1.plugins.canvasOverlay;
  334. // var x1max = findXValue($("input[type=text][name=userLine1]").val(), dataSets[val])[1][0];
  335. // co.get("line1").options.xmax = co.get("line3").options.x = x1max;
  336. // var x2max = findXValue($("input[type=text][name=userLine2]").val(), dataSets[val])[1][0];
  337. // co.get("line2").options.xmax = co.get("line4").options.x = x2max;
  338. plot1.replot();
  339. });
  340. $("input[type=checkbox][name=gridsVertical]").change(function(){
  341. plot1.axes.xaxis.tickOptions.showGridline = this.checked;
  342. plot1.replot();
  343. });
  344. $("input[type=checkbox][name=gridsHorizontal]").change(function(){
  345. plot1.axes.yaxis.tickOptions.showGridline = this.checked;
  346. plot1.replot();
  347. });
  348. $("input[type=checkbox][name=cutoffLines]").change(function(){
  349. var co = plot1.plugins.canvasOverlay;
  350. if (this.checked) {
  351. co.get('line1').options.show = true;
  352. co.get('line2').options.show = true;
  353. co.get('line3').options.show = true;
  354. co.get('line4').options.show = true;
  355. }
  356. else {
  357. co.get('line1').options.show = false;
  358. co.get('line2').options.show = false;
  359. co.get('line3').options.show = false;
  360. co.get('line4').options.show = false;
  361. }
  362. plot1.replot();
  363. });
  364. $("input[type=text][name=userLine1]").keyup(function(){
  365. var val = parseFloat($(this).val());
  366. var co = plot1.plugins.canvasOverlay;
  367. co.get("line1").options.y = val;
  368. co.get("line3").options.ymax = val;
  369. var xx = findXValue(val, plot1.series[0].data)[1][0];
  370. co.get("line1").options.xmax = co.get("line3").options.x = xx;
  371. plot1.replot();
  372. });
  373. $("input[type=text][name=userLine2]").keyup(function(){
  374. var val = parseFloat($(this).val());
  375. var co = plot1.plugins.canvasOverlay;
  376. co.get("line2").options.y = val;
  377. co.get("line4").options.ymax = val;
  378. var xx = findXValue(val, plot1.series[0].data)[1][0];
  379. co.get("line2").options.xmax = co.get("line4").options.x = xx;
  380. plot1.replot();
  381. });
  382. $("input[type=radio][name=lineWidth]").change(function(){
  383. var val = parseFloat($(this).val()), shadowOffset;
  384. plot1.series[0].renderer.shapeRenderer.lineWidth = val;
  385. plot1.series[0].renderer.shadowRenderer.lineWidth = val;
  386. // for thick lines, scale shadow offset.
  387. if (val > 2.5) {
  388. shadowOffset = 1.25 * (1 + (Math.atan((val/2.5))/0.785398163 - 1)*0.6);
  389. // var shadow_offset = this.shadowOffset;
  390. }
  391. // for skinny lines, don't make such a big shadow.
  392. else {
  393. shadowOffset = 1.25*Math.atan((val/2.5))/0.785398163;
  394. }
  395. plot1.series[0].renderer.shadowRenderer.offset = shadowOffset;
  396. for (var i=0, l=plot1.plugins.canvasOverlay.objects.length; i<l; i++) {
  397. plot1.plugins.canvasOverlay.objects[i].options.lineWidth = val;
  398. }
  399. plot1.replot();
  400. });
  401. $("div.chart-container").resizable({delay:20, aspectRatio: true});
  402. $("div.chart-container").bind("resize", function(event, ui) {
  403. plot1.replot();
  404. });
  405. $(".jqplot-target").mouseleave(function(){ $('.jqplot-canvasOverlay-tooltip, .jqplot-highlighter-tooltip, .jqpot-cursor-tooltip').hide(); });
  406. });
  407. </script>
  408. <!-- End example scripts -->
  409. <!-- Don't touch this! -->
  410. <script class="include" type="text/javascript" src="../jquery.jqplot.min.js"></script>
  411. <script type="text/javascript" src="syntaxhighlighter/scripts/shCore.min.js"></script>
  412. <script type="text/javascript" src="syntaxhighlighter/scripts/shBrushJScript.min.js"></script>
  413. <script type="text/javascript" src="syntaxhighlighter/scripts/shBrushXml.min.js"></script>
  414. <!-- End Don't touch this! -->
  415. <!-- Additional plugins go here -->>
  416. <script class="include" type="text/javascript" src="../plugins/jqplot.logAxisRenderer.min.js"></script>
  417. <script class="include" type="text/javascript" src="../plugins/jqplot.cursor.min.js"></script>
  418. <script class="include" type="text/javascript" src="../plugins/jqplot.canvasTextRenderer.min.js"></script>
  419. <script class="include" type="text/javascript" src="../plugins/jqplot.canvasAxisLabelRenderer.min.js"></script>
  420. <script class="include" type="text/javascript" src="../plugins/jqplot.highlighter.min.js"></script>
  421. <script class="include" type="text/javascript" src="../plugins/jqplot.canvasOverlay.min.js"></script>
  422. <script class="include" type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.0/jquery-ui.min.js"></script>
  423. <!-- End additional plugins -->
  424. </div>
  425. <div class="col2">
  426. <div class="example-link"><a class="example-link" href="data-renderers.html">AJAX and JSON Data Loading via Data Renderers</a></div>
  427. <div class="example-link"><a class="example-link" href="barLineAnimated.html">Animated Charts</a></div>
  428. <div class="example-link"><a class="example-link" href="dashboardWidget.html">Animated Dashboard Sample - Filled Line with Log Axis</a></div>
  429. <div class="example-link"><a class="example-link" href="kcp_area.html">Area Chart</a></div>
  430. <div class="example-link"><a class="example-link" href="kcp_area2.html">Area Chart 2</a></div>
  431. <div class="example-link"><a class="example-link" href="axisLabelTests.html">Axis Labels</a></div>
  432. <div class="example-link"><a class="example-link" href="axisLabelsRotatedText.html">Axis Labels and Rotated Text</a></div>
  433. <div class="example-link"><a class="example-link" href="barTest.html">Bar Charts</a></div>
  434. <div class="example-link"><a class="example-link" href="multipleBarColors.html">Bar Colors Example</a></div>
  435. <div class="example-link"><a class="example-link" href="bezierCurve.html">Bezier Curve Plots</a></div>
  436. <div class="example-link"><a class="example-link" href="blockPlot.html">Block Plots</a></div>
  437. <div class="example-link"><a class="example-link" href="bubbleChart.html">Bubble Charts</a></div>
  438. <div class="example-link"><a class="example-link" href="bubble-plots.html">Bubble Plots</a></div>
  439. <div class="example-link"><a class="example-link" href="candlestick.html">Candlestick and Open Hi Low Close Charts</a></div>
  440. <div class="example-link"><a class="example-link" href="theming.html">Chart Theming</a></div>
  441. <div class="example-link"><a class="example-link" href="fillBetweenLines.html">Charts with Fill Between Lines</a></div>
  442. <div class="example-link"><a class="example-link" href="kcp_cdf.html">Cumulative Density Function Chart</a></div>
  443. <div class="example-link"><a class="example-link" href="dashedLines.html">Dashed Lines with Smoothing</a></div>
  444. <div class="example-link"><a class="example-link" href="cursor-highlighter.html">Data Point Highlighting, Tooltips and Cursor Tracking</a></div>
  445. <div class="example-link"><a class="example-link" href="point-labels.html">Data Point labels</a></div>
  446. <div class="example-link"><a class="example-link" href="date-axes.html">Date Axes</a></div>
  447. <div class="example-link"><a class="example-link" href="dateAxisRenderer.html">Date Axes 2</a></div>
  448. <div class="example-link"><a class="example-link" href="rotatedTickLabelsZoom.html">Date Axes, Rotated Labels and Zooming</a></div>
  449. <div class="example-link"><a class="example-link" href="canvas-overlay.html">Draw Lines on Plots - Canvas Overlay</a></div>
  450. <div class="example-link"><a class="example-link" href="draw-rectangles.html">Draw Rectangles on Plots</a></div>
  451. <div class="example-link"><a class="example-link" href="kcp_engel.html">Engel Curves</a></div>
  452. <div class="example-link"><a class="example-link" href="bandedLine.html">Error Bands and Confidence Intervals</a></div>
  453. <div class="example-link"><a class="example-link" href="area.html">Filled (Area) Charts</a></div>
  454. <div class="example-link"><a class="example-link" href="axisScalingForceTickAt.html">Force Plot to Have Tick at 0 or 100</a></div>
  455. <div class="example-link"><a class="example-link" href="hiddenPlotsInTabs.html">Hidden Plots</a></div>
  456. <div class="example-link"><a class="example-link" href="customHighlighterCursorTrendline.html">Highlighting, Dragging Points, Cursor and Trend Lines</a></div>
  457. <div class="example-link"><a class="example-link" href="line-charts.html">Line Charts and Options</a></div>
  458. <div class="example-link"><a class="example-link" href="kcp_lorenz.html">Lorenz Curves</a></div>
  459. <div class="example-link"><a class="example-link" href="mekkoCharts.html">Mekko Charts</a></div>
  460. <div class="example-link"><a class="example-link" href="meterGauge.html">Meter Gauge</a></div>
  461. <div class="example-link"><a class="example-link" href="candlestick-charts.html">Open Hi Low Close and Candlestick Charts</a></div>
  462. <div class="example-link"><a class="example-link" href="pieTest.html">Pie Charts and Options</a></div>
  463. <div class="example-link"><a class="example-link" href="pieTest4.html">Pie Charts and Options 2</a></div>
  464. <div class="example-link"><a class="example-link" href="pie-donut-charts.html">Pie and Donut Charts</a></div>
  465. <div class="example-link"><a class="example-link" href="selectorSyntax.html">Plot Creation with jQuery Selectors</a></div>
  466. <div class="example-link"><a class="example-link" href="zooming.html">Plot Zooming and Cursor Control</a></div>
  467. <div class="example-link"><a class="example-link" href="kcp_pdf.html">Probability Density Function Chart</a></div>
  468. <div class="example-link"><a class="example-link" href="kcp_pyramid_by_age.html">Pyramid Chart By Age</a></div>
  469. <div class="example-link"><a class="example-link" href="kcp_pyramid.html">Pyramid Charts</a></div>
  470. <div class="example-link"><a class="example-link" href="kcp_pyramid2.html">Pyramid Charts 2</a></div>
  471. <div class="example-link"><a class="example-link" href="kcp_quintiles.html">Quintile Pyramid Charts</a></div>
  472. <div class="example-link"><a class="example-link" href="resizablePlot.html">Resizable Plots</a></div>
  473. <div class="example-link"><a class="example-link" href="rotated-tick-labels.html">Rotated Labels and Font Styling</a></div>
  474. <div class="example-link"><a class="example-link" href="smoothedLine.html">Smoothed Lines</a></div>
  475. <div class="example-link"><a class="example-link" href="bar-charts.html">Vertical and Horizontal Bar Charts</a></div>
  476. <div class="example-link"><a class="example-link" href="waterfall.html">Waterfall Charts</a></div>
  477. <div class="example-link"><a class="example-link" href="waterfall2.html">Waterfall Charts 2</a></div>
  478. <div class="example-link"><a class="example-link" href="zoomOptions.html">Zoom Options</a></div>
  479. <div class="example-link"><a class="example-link" href="zoomProxy.html">Zoom Proxy - Control one plot from another</a></div>
  480. <div class="example-link"><a class="example-link" href="zoom1.html">Zooming</a></div>
  481. <div class="example-link"><a class="example-link" href="dateAxisLogAxisZooming.html">Zooming with Date and Log Axes</a></div>
  482. </div>
  483. </div>
  484. </div>
  485. <script type="text/javascript" src="example.min.js"></script>
  486. </body>
  487. </html>