rotated-tick-labels.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Rotated Labels and Font Styling</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. <p>Rotated axis tick labels are possible through the "jqplot.canvasTextRenderer.min.js" and "jqplot.canvasAxisTickRenderer.min.js" plugins. Native canvas font rendering capabilities are used in supported browsers. This includes most recent browsers (including IE 9). In browsers which don't support native canvas font text, text is rendered in the Hershey font.</p>
  27. <div id="chart1" style="height:300px; width:500px;"></div>
  28. <pre class="code prettyprint brush: js"></pre>
  29. <p>For comparison, here is the same graph with the "fontFamily" and "fontSize" set. If you have a supported browser, you should see a difference in label fonts.</p>
  30. <div id="chart1b" style="height:300px; width:500px;"></div>
  31. <pre class="code prettyprint brush: js"></pre>
  32. <p>The default positioning applies to either primary or secondary axes and accounts for label rotation to ensure that the labels point to the appropriate bar or tick position.</p>
  33. <p>Also note here the use of the "autoscale" option on the y axes. Turning this option on will force the y axes to line up tick marks for consistend grid lines across the grid.</p>
  34. <div id="chart2" style="height:300px; width:500px;"></div>
  35. <pre class="code prettyprint brush: js"></pre>
  36. <p>You can override the default position by specifying a labelPosition of 'start', 'middle' or 'end'. The results probably are not as pleasing as the default 'auto' setting.</p>
  37. <div id="chart3" style="height:300px; width:500px;"></div>
  38. <pre class="code prettyprint brush: js"></pre>
  39. <script class="code" type="text/javascript">
  40. $(document).ready(function(){
  41. var line1 = [['Cup Holder Pinion Bob', 7], ['Generic Fog Lamp', 9], ['HDTV Receiver', 15],
  42. ['8 Track Control Module', 12], [' Sludge Pump Fourier Modulator', 3],
  43. ['Transcender/Spice Rack', 6], ['Hair Spray Danger Indicator', 18]];
  44. var plot1 = $.jqplot('chart1', [line1], {
  45. title: 'Concern vs. Occurrance',
  46. series:[{renderer:$.jqplot.BarRenderer}],
  47. axesDefaults: {
  48. tickRenderer: $.jqplot.CanvasAxisTickRenderer ,
  49. tickOptions: {
  50. angle: -30,
  51. fontSize: '10pt'
  52. }
  53. },
  54. axes: {
  55. xaxis: {
  56. renderer: $.jqplot.CategoryAxisRenderer
  57. }
  58. }
  59. });
  60. });
  61. </script>
  62. <script class="code" type="text/javascript">
  63. $(document).ready(function(){
  64. var line1 = [['Cup Holder Pinion Bob', 7], ['Generic Fog Lamp', 9], ['HDTV Receiver', 15],
  65. ['8 Track Control Module', 12], [' Sludge Pump Fourier Modulator', 3],
  66. ['Transcender/Spice Rack', 6], ['Hair Spray Danger Indicator', 18]];
  67. var plot1b = $.jqplot('chart1b', [line1], {
  68. title: 'Concern vs. Occurrance',
  69. series:[{renderer:$.jqplot.BarRenderer}],
  70. axesDefaults: {
  71. tickRenderer: $.jqplot.CanvasAxisTickRenderer ,
  72. tickOptions: {
  73. fontFamily: 'Georgia',
  74. fontSize: '10pt',
  75. angle: -30
  76. }
  77. },
  78. axes: {
  79. xaxis: {
  80. renderer: $.jqplot.CategoryAxisRenderer
  81. }
  82. }
  83. });
  84. });
  85. </script>
  86. <script class="code" type="text/javascript">
  87. $(document).ready(function(){
  88. var line1 = [['Cup Holder Pinion Bob', 7], ['Generic Fog Lamp', 9], ['HDTV Receiver', 15],
  89. ['8 Track Control Module', 12], [' Sludge Pump Fourier Modulator', 3],
  90. ['Transcender/Spice Rack', 6], ['Hair Spray Danger Indicator', 18]];
  91. var line2 = [['Nickle', 28], ['Aluminum', 13], ['Xenon', 54], ['Silver', 47],
  92. ['Sulfer', 16], ['Silicon', 14], ['Vanadium', 23]];
  93. var plot2 = $.jqplot('chart2', [line1, line2], {
  94. series:[{renderer:$.jqplot.BarRenderer}, {xaxis:'x2axis', yaxis:'y2axis'}],
  95. axesDefaults: {
  96. tickRenderer: $.jqplot.CanvasAxisTickRenderer ,
  97. tickOptions: {
  98. angle: 30
  99. }
  100. },
  101. axes: {
  102. xaxis: {
  103. renderer: $.jqplot.CategoryAxisRenderer
  104. },
  105. x2axis: {
  106. renderer: $.jqplot.CategoryAxisRenderer
  107. },
  108. yaxis: {
  109. autoscale:true
  110. },
  111. y2axis: {
  112. autoscale:true
  113. }
  114. }
  115. });
  116. });
  117. </script>
  118. <script class="code" type="text/javascript">
  119. $(document).ready(function(){
  120. var line1 = [['Cup Holder Pinion Bob', 7], ['Generic Fog Lamp', 9], ['HDTV Receiver', 15],
  121. ['8 Track Control Module', 12], [' Sludge Pump Fourier Modulator', 3],
  122. ['Transcender/Spice Rack', 6], ['Hair Spray Danger Indicator', 18]];
  123. var plot3 = $.jqplot('chart3', [line1], {
  124. title: 'Concern vs. Occurrance',
  125. series:[{renderer:$.jqplot.BarRenderer}],
  126. axesDefaults: {
  127. tickRenderer: $.jqplot.CanvasAxisTickRenderer,
  128. tickOptions: {
  129. angle: -30
  130. }
  131. },
  132. axes: {
  133. xaxis: {
  134. renderer: $.jqplot.CategoryAxisRenderer,
  135. tickOptions: {
  136. labelPosition: 'middle'
  137. }
  138. },
  139. yaxis: {
  140. autoscale:true,
  141. tickRenderer: $.jqplot.CanvasAxisTickRenderer,
  142. tickOptions: {
  143. labelPosition: 'start'
  144. }
  145. }
  146. }
  147. });
  148. });
  149. </script>
  150. <!-- End example scripts -->
  151. <!-- Don't touch this! -->
  152. <script class="include" type="text/javascript" src="../jquery.jqplot.min.js"></script>
  153. <script type="text/javascript" src="syntaxhighlighter/scripts/shCore.min.js"></script>
  154. <script type="text/javascript" src="syntaxhighlighter/scripts/shBrushJScript.min.js"></script>
  155. <script type="text/javascript" src="syntaxhighlighter/scripts/shBrushXml.min.js"></script>
  156. <!-- End Don't touch this! -->
  157. <!-- Additional plugins go here -->
  158. <script class="include" language="javascript" type="text/javascript" src="../plugins/jqplot.dateAxisRenderer.min.js"></script>
  159. <script class="include" language="javascript" type="text/javascript" src="../plugins/jqplot.canvasTextRenderer.min.js"></script>
  160. <script class="include" language="javascript" type="text/javascript" src="../plugins/jqplot.canvasAxisTickRenderer.min.js"></script>
  161. <script class="include" language="javascript" type="text/javascript" src="../plugins/jqplot.categoryAxisRenderer.min.js"></script>
  162. <script class="include" language="javascript" type="text/javascript" src="../plugins/jqplot.barRenderer.min.js"></script>
  163. <!-- End additional plugins -->
  164. </div>
  165. <div class="col2">
  166. <div class="example-link"><a class="example-link" href="data-renderers.html">AJAX and JSON Data Loading via Data Renderers</a></div>
  167. <div class="example-link"><a class="example-link" href="barLineAnimated.html">Animated Charts</a></div>
  168. <div class="example-link"><a class="example-link" href="dashboardWidget.html">Animated Dashboard Sample - Filled Line with Log Axis</a></div>
  169. <div class="example-link"><a class="example-link" href="kcp_area.html">Area Chart</a></div>
  170. <div class="example-link"><a class="example-link" href="kcp_area2.html">Area Chart 2</a></div>
  171. <div class="example-link"><a class="example-link" href="axisLabelTests.html">Axis Labels</a></div>
  172. <div class="example-link"><a class="example-link" href="axisLabelsRotatedText.html">Axis Labels and Rotated Text</a></div>
  173. <div class="example-link"><a class="example-link" href="barTest.html">Bar Charts</a></div>
  174. <div class="example-link"><a class="example-link" href="multipleBarColors.html">Bar Colors Example</a></div>
  175. <div class="example-link"><a class="example-link" href="bezierCurve.html">Bezier Curve Plots</a></div>
  176. <div class="example-link"><a class="example-link" href="blockPlot.html">Block Plots</a></div>
  177. <div class="example-link"><a class="example-link" href="bubbleChart.html">Bubble Charts</a></div>
  178. <div class="example-link"><a class="example-link" href="bubble-plots.html">Bubble Plots</a></div>
  179. <div class="example-link"><a class="example-link" href="candlestick.html">Candlestick and Open Hi Low Close Charts</a></div>
  180. <div class="example-link"><a class="example-link" href="theming.html">Chart Theming</a></div>
  181. <div class="example-link"><a class="example-link" href="fillBetweenLines.html">Charts with Fill Between Lines</a></div>
  182. <div class="example-link"><a class="example-link" href="kcp_cdf.html">Cumulative Density Function Chart</a></div>
  183. <div class="example-link"><a class="example-link" href="dashedLines.html">Dashed Lines with Smoothing</a></div>
  184. <div class="example-link"><a class="example-link" href="cursor-highlighter.html">Data Point Highlighting, Tooltips and Cursor Tracking</a></div>
  185. <div class="example-link"><a class="example-link" href="point-labels.html">Data Point labels</a></div>
  186. <div class="example-link"><a class="example-link" href="date-axes.html">Date Axes</a></div>
  187. <div class="example-link"><a class="example-link" href="dateAxisRenderer.html">Date Axes 2</a></div>
  188. <div class="example-link"><a class="example-link" href="rotatedTickLabelsZoom.html">Date Axes, Rotated Labels and Zooming</a></div>
  189. <div class="example-link"><a class="example-link" href="canvas-overlay.html">Draw Lines on Plots - Canvas Overlay</a></div>
  190. <div class="example-link"><a class="example-link" href="draw-rectangles.html">Draw Rectangles on Plots</a></div>
  191. <div class="example-link"><a class="example-link" href="kcp_engel.html">Engel Curves</a></div>
  192. <div class="example-link"><a class="example-link" href="bandedLine.html">Error Bands and Confidence Intervals</a></div>
  193. <div class="example-link"><a class="example-link" href="area.html">Filled (Area) Charts</a></div>
  194. <div class="example-link"><a class="example-link" href="axisScalingForceTickAt.html">Force Plot to Have Tick at 0 or 100</a></div>
  195. <div class="example-link"><a class="example-link" href="hiddenPlotsInTabs.html">Hidden Plots</a></div>
  196. <div class="example-link"><a class="example-link" href="customHighlighterCursorTrendline.html">Highlighting, Dragging Points, Cursor and Trend Lines</a></div>
  197. <div class="example-link"><a class="example-link" href="line-charts.html">Line Charts and Options</a></div>
  198. <div class="example-link"><a class="example-link" href="kcp_lorenz.html">Lorenz Curves</a></div>
  199. <div class="example-link"><a class="example-link" href="mekkoCharts.html">Mekko Charts</a></div>
  200. <div class="example-link"><a class="example-link" href="meterGauge.html">Meter Gauge</a></div>
  201. <div class="example-link"><a class="example-link" href="candlestick-charts.html">Open Hi Low Close and Candlestick Charts</a></div>
  202. <div class="example-link"><a class="example-link" href="pieTest.html">Pie Charts and Options</a></div>
  203. <div class="example-link"><a class="example-link" href="pieTest4.html">Pie Charts and Options 2</a></div>
  204. <div class="example-link"><a class="example-link" href="pie-donut-charts.html">Pie and Donut Charts</a></div>
  205. <div class="example-link"><a class="example-link" href="selectorSyntax.html">Plot Creation with jQuery Selectors</a></div>
  206. <div class="example-link"><a class="example-link" href="zooming.html">Plot Zooming and Cursor Control</a></div>
  207. <div class="example-link"><a class="example-link" href="kcp_pdf.html">Probability Density Function Chart</a></div>
  208. <div class="example-link"><a class="example-link" href="kcp_pyramid_by_age.html">Pyramid Chart By Age</a></div>
  209. <div class="example-link"><a class="example-link" href="kcp_pyramid.html">Pyramid Charts</a></div>
  210. <div class="example-link"><a class="example-link" href="kcp_pyramid2.html">Pyramid Charts 2</a></div>
  211. <div class="example-link"><a class="example-link" href="kcp_quintiles.html">Quintile Pyramid Charts</a></div>
  212. <div class="example-link"><a class="example-link" href="resizablePlot.html">Resizable Plots</a></div>
  213. <div class="example-link"><a class="example-link" href="rotated-tick-labels.html">Rotated Labels and Font Styling</a></div>
  214. <div class="example-link"><a class="example-link" href="smoothedLine.html">Smoothed Lines</a></div>
  215. <div class="example-link"><a class="example-link" href="bar-charts.html">Vertical and Horizontal Bar Charts</a></div>
  216. <div class="example-link"><a class="example-link" href="waterfall.html">Waterfall Charts</a></div>
  217. <div class="example-link"><a class="example-link" href="waterfall2.html">Waterfall Charts 2</a></div>
  218. <div class="example-link"><a class="example-link" href="zoomOptions.html">Zoom Options</a></div>
  219. <div class="example-link"><a class="example-link" href="zoomProxy.html">Zoom Proxy - Control one plot from another</a></div>
  220. <div class="example-link"><a class="example-link" href="zoom1.html">Zooming</a></div>
  221. <div class="example-link"><a class="example-link" href="dateAxisLogAxisZooming.html">Zooming with Date and Log Axes</a></div>
  222. </div>
  223. </div>
  224. </div>
  225. <script type="text/javascript" src="example.min.js"></script>
  226. </body>
  227. </html>