point-labels.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Data Point labels</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. <style type="text/css">
  26. #chart3 .jqplot-point-label {
  27. border: 1.5px solid #aaaaaa;
  28. padding: 1px 3px;
  29. background-color: #eeccdd;
  30. }
  31. </style>
  32. <!-- Example scripts go here -->
  33. <P>The pointLabels plugin places labels on the plot at the data point locations. Labeles can use the series data array or a separate labels array. If using the series data, the last value in the data point array is used as the label by default.</p>
  34. <div id="chart1" style="height:300px; width:500px;"></div>
  35. <pre class="code prettyprint brush: js"></pre>
  36. <P>Additional data can be added to the series and it will be used for labels. If additional data is provided, each data point must have a value for the label, even if it is "null".</p>
  37. <div id="chart2" style="height:300px; width:500px;"></div>
  38. <pre class="code prettyprint brush: js"></pre>
  39. <P>Labels work with Bar charts as well. Here, the Labels have been supplied through the "labels" array on the "pointLabels" option to the series. Also, additional css styling has been provided to the labels.</p>
  40. <div id="chart3" style="height:300px; width:500px;"></div>
  41. <pre class="prettyprint brush: html">
  42. <style type="text/css">
  43. #chart3 .jqplot-point-label {
  44. border: 1.5px solid #aaaaaa;
  45. padding: 1px 3px;
  46. background-color: #eeccdd;
  47. }
  48. </style>
  49. </pre>
  50. <pre class="code prettyprint brush: js"></pre>
  51. <P>Point labels can be used on stacked bar charts. If no labels array is specified, they will use data from the chart. Values can be displayed individually for each series (stackedValue option is false, the default), or cumulative values for all series can be displayed (stackedValue option is true).</p>
  52. <div id="chart4" style="height:300px; width:500px;"></div>
  53. <pre class="code prettyprint brush: js"></pre>
  54. <P>Data point labels have an "edgeTolerance" option. This options controls how close the data point label can be to an axis edge and still be drawn. The default of 0 allows labels to touch the axis. Positive values will increase the required distance between the axis and label, negative values will allow labels to overlap axes.</p>
  55. <div id="chart5" style="height:300px; width:500px;"></div>
  56. <pre class="code prettyprint brush: js"></pre>
  57. <script class="code" type="text/javascript">
  58. $(document).ready(function(){
  59. var line1 = [14, 32, 41, 44, 40, 47, 53, 67];
  60. var plot1 = $.jqplot('chart1', [line1], {
  61. title: 'Chart with Point Labels',
  62. seriesDefaults: {
  63. showMarker:false,
  64. pointLabels: { show:true }
  65. }
  66. });
  67. });
  68. </script>
  69. <script class="code" type="text/javascript">
  70. $(document).ready(function(){
  71. var line1 = [[-12, 7, null], [-3, 14, null], [2, -1, '(low)'],
  72. [7, -1, '(low)'], [11, 11, null], [13, -1, '(low)']];
  73. var plot2 = $.jqplot('chart2', [line1], {
  74. title: 'Point Labels From Extra Series Data',
  75. seriesDefaults: {
  76. showMarker:false,
  77. pointLabels:{ show:true, location:'s', ypadding:3 }
  78. },
  79. axes:{ yaxis:{ pad: 1.3 } }
  80. });
  81. });
  82. </script>
  83. <script class="code" type="text/javascript">
  84. $(document).ready(function(){
  85. var line1 = [14, 32, 41, 44, 40];
  86. var plot3 = $.jqplot('chart3', [line1], {
  87. title: 'Bar Chart with Point Labels',
  88. seriesDefaults: {renderer: $.jqplot.BarRenderer},
  89. series:[
  90. {pointLabels:{
  91. show: true,
  92. labels:['fourteen', 'thirty two', 'fourty one', 'fourty four', 'fourty']
  93. }}],
  94. axes: {
  95. xaxis:{renderer:$.jqplot.CategoryAxisRenderer},
  96. yaxis:{padMax:1.3}}
  97. });
  98. });
  99. </script>
  100. <script class="code" type="text/javascript">
  101. $(document).ready(function(){
  102. var line1 = [14, 32, 41, 44, 40, 37, 29];
  103. var line2 = [7, 12, 15, 17, 20, 27, 39];
  104. var plot4 = $.jqplot('chart4', [line1, line2], {
  105. title: 'Stacked Bar Chart with Cumulative Point Labels',
  106. stackSeries: true,
  107. seriesDefaults: {
  108. renderer: $.jqplot.BarRenderer,
  109. rendererOptions:{barMargin: 25},
  110. pointLabels:{show:true, stackedValue: true}
  111. },
  112. axes: {
  113. xaxis:{renderer:$.jqplot.CategoryAxisRenderer}
  114. }
  115. });
  116. });
  117. </script>
  118. <script class="code" type="text/javascript">
  119. $(document).ready(function(){
  120. var line1 = [14, 32, 41, 44, 40, 47, 53, 67];
  121. var plot5 = $.jqplot('chart5', [line1], {
  122. title: 'Chart with Point Labels',
  123. seriesDefaults: {
  124. showMarker:false,
  125. pointLabels: {
  126. show: true,
  127. edgeTolerance: 5
  128. }},
  129. axes:{
  130. xaxis:{min:3}
  131. }
  132. });
  133. });
  134. </script>
  135. <!-- End example scripts -->
  136. <!-- Don't touch this! -->
  137. <script class="include" type="text/javascript" src="../jquery.jqplot.min.js"></script>
  138. <script type="text/javascript" src="syntaxhighlighter/scripts/shCore.min.js"></script>
  139. <script type="text/javascript" src="syntaxhighlighter/scripts/shBrushJScript.min.js"></script>
  140. <script type="text/javascript" src="syntaxhighlighter/scripts/shBrushXml.min.js"></script>
  141. <!-- End Don't touch this! -->
  142. <!-- Additional plugins go here -->
  143. <script class="include" language="javascript" type="text/javascript" src="../plugins/jqplot.barRenderer.min.js"></script>
  144. <script class="include" language="javascript" type="text/javascript" src="../plugins/jqplot.categoryAxisRenderer.min.js"></script>
  145. <script class="include" language="javascript" type="text/javascript" src="../plugins/jqplot.pointLabels.min.js"></script>
  146. <!-- End additional plugins -->
  147. </div>
  148. <div class="col2">
  149. <div class="example-link"><a class="example-link" href="data-renderers.html">AJAX and JSON Data Loading via Data Renderers</a></div>
  150. <div class="example-link"><a class="example-link" href="barLineAnimated.html">Animated Charts</a></div>
  151. <div class="example-link"><a class="example-link" href="dashboardWidget.html">Animated Dashboard Sample - Filled Line with Log Axis</a></div>
  152. <div class="example-link"><a class="example-link" href="kcp_area.html">Area Chart</a></div>
  153. <div class="example-link"><a class="example-link" href="kcp_area2.html">Area Chart 2</a></div>
  154. <div class="example-link"><a class="example-link" href="axisLabelTests.html">Axis Labels</a></div>
  155. <div class="example-link"><a class="example-link" href="axisLabelsRotatedText.html">Axis Labels and Rotated Text</a></div>
  156. <div class="example-link"><a class="example-link" href="barTest.html">Bar Charts</a></div>
  157. <div class="example-link"><a class="example-link" href="multipleBarColors.html">Bar Colors Example</a></div>
  158. <div class="example-link"><a class="example-link" href="bezierCurve.html">Bezier Curve Plots</a></div>
  159. <div class="example-link"><a class="example-link" href="blockPlot.html">Block Plots</a></div>
  160. <div class="example-link"><a class="example-link" href="bubbleChart.html">Bubble Charts</a></div>
  161. <div class="example-link"><a class="example-link" href="bubble-plots.html">Bubble Plots</a></div>
  162. <div class="example-link"><a class="example-link" href="candlestick.html">Candlestick and Open Hi Low Close Charts</a></div>
  163. <div class="example-link"><a class="example-link" href="theming.html">Chart Theming</a></div>
  164. <div class="example-link"><a class="example-link" href="fillBetweenLines.html">Charts with Fill Between Lines</a></div>
  165. <div class="example-link"><a class="example-link" href="kcp_cdf.html">Cumulative Density Function Chart</a></div>
  166. <div class="example-link"><a class="example-link" href="dashedLines.html">Dashed Lines with Smoothing</a></div>
  167. <div class="example-link"><a class="example-link" href="cursor-highlighter.html">Data Point Highlighting, Tooltips and Cursor Tracking</a></div>
  168. <div class="example-link"><a class="example-link" href="point-labels.html">Data Point labels</a></div>
  169. <div class="example-link"><a class="example-link" href="date-axes.html">Date Axes</a></div>
  170. <div class="example-link"><a class="example-link" href="dateAxisRenderer.html">Date Axes 2</a></div>
  171. <div class="example-link"><a class="example-link" href="rotatedTickLabelsZoom.html">Date Axes, Rotated Labels and Zooming</a></div>
  172. <div class="example-link"><a class="example-link" href="canvas-overlay.html">Draw Lines on Plots - Canvas Overlay</a></div>
  173. <div class="example-link"><a class="example-link" href="draw-rectangles.html">Draw Rectangles on Plots</a></div>
  174. <div class="example-link"><a class="example-link" href="kcp_engel.html">Engel Curves</a></div>
  175. <div class="example-link"><a class="example-link" href="bandedLine.html">Error Bands and Confidence Intervals</a></div>
  176. <div class="example-link"><a class="example-link" href="area.html">Filled (Area) Charts</a></div>
  177. <div class="example-link"><a class="example-link" href="axisScalingForceTickAt.html">Force Plot to Have Tick at 0 or 100</a></div>
  178. <div class="example-link"><a class="example-link" href="hiddenPlotsInTabs.html">Hidden Plots</a></div>
  179. <div class="example-link"><a class="example-link" href="customHighlighterCursorTrendline.html">Highlighting, Dragging Points, Cursor and Trend Lines</a></div>
  180. <div class="example-link"><a class="example-link" href="line-charts.html">Line Charts and Options</a></div>
  181. <div class="example-link"><a class="example-link" href="kcp_lorenz.html">Lorenz Curves</a></div>
  182. <div class="example-link"><a class="example-link" href="mekkoCharts.html">Mekko Charts</a></div>
  183. <div class="example-link"><a class="example-link" href="meterGauge.html">Meter Gauge</a></div>
  184. <div class="example-link"><a class="example-link" href="candlestick-charts.html">Open Hi Low Close and Candlestick Charts</a></div>
  185. <div class="example-link"><a class="example-link" href="pieTest.html">Pie Charts and Options</a></div>
  186. <div class="example-link"><a class="example-link" href="pieTest4.html">Pie Charts and Options 2</a></div>
  187. <div class="example-link"><a class="example-link" href="pie-donut-charts.html">Pie and Donut Charts</a></div>
  188. <div class="example-link"><a class="example-link" href="selectorSyntax.html">Plot Creation with jQuery Selectors</a></div>
  189. <div class="example-link"><a class="example-link" href="zooming.html">Plot Zooming and Cursor Control</a></div>
  190. <div class="example-link"><a class="example-link" href="kcp_pdf.html">Probability Density Function Chart</a></div>
  191. <div class="example-link"><a class="example-link" href="kcp_pyramid_by_age.html">Pyramid Chart By Age</a></div>
  192. <div class="example-link"><a class="example-link" href="kcp_pyramid.html">Pyramid Charts</a></div>
  193. <div class="example-link"><a class="example-link" href="kcp_pyramid2.html">Pyramid Charts 2</a></div>
  194. <div class="example-link"><a class="example-link" href="kcp_quintiles.html">Quintile Pyramid Charts</a></div>
  195. <div class="example-link"><a class="example-link" href="resizablePlot.html">Resizable Plots</a></div>
  196. <div class="example-link"><a class="example-link" href="rotated-tick-labels.html">Rotated Labels and Font Styling</a></div>
  197. <div class="example-link"><a class="example-link" href="smoothedLine.html">Smoothed Lines</a></div>
  198. <div class="example-link"><a class="example-link" href="bar-charts.html">Vertical and Horizontal Bar Charts</a></div>
  199. <div class="example-link"><a class="example-link" href="waterfall.html">Waterfall Charts</a></div>
  200. <div class="example-link"><a class="example-link" href="waterfall2.html">Waterfall Charts 2</a></div>
  201. <div class="example-link"><a class="example-link" href="zoomOptions.html">Zoom Options</a></div>
  202. <div class="example-link"><a class="example-link" href="zoomProxy.html">Zoom Proxy - Control one plot from another</a></div>
  203. <div class="example-link"><a class="example-link" href="zoom1.html">Zooming</a></div>
  204. <div class="example-link"><a class="example-link" href="dateAxisLogAxisZooming.html">Zooming with Date and Log Axes</a></div>
  205. </div>
  206. </div>
  207. </div>
  208. <script type="text/javascript" src="example.min.js"></script>
  209. </body>
  210. </html>