Commits

Anonymous committed 26d0271

added example

Comments (0)

Files changed (1)

examples/intticks.html

+<!DOCTYPE html>
+
+<html lang="en">
+<head>
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+  <title>Simple Test</title>
+  <!--[if IE]><script language="javascript" type="text/javascript" src="../src/excanvas.js"></script><![endif]-->
+  
+  <link rel="stylesheet" type="text/css" href="../src/jquery.jqplot.css" />
+  <link rel="stylesheet" type="text/css" href="examples.css" />
+  
+  <!-- BEGIN: load jquery -->
+  <script language="javascript" type="text/javascript" src="../src/jquery-1.4.2.min.js"></script>
+  <!-- END: load jquery -->
+  
+  <!-- BEGIN: load jqplot -->
+  <script language="javascript" type="text/javascript" src="../src/jquery.jqplot.js"></script>
+  <script language="javascript" type="text/javascript" src="../src/plugins/jqplot.barRenderer.js"></script>
+  <script language="javascript" type="text/javascript" src="../src/plugins/jqplot.categoryAxisRenderer.js"></script>
+  <!-- END: load jqplot -->
+
+
+<script language="javascript" type="text/javascript">
+$(document).ready(function(){
+
+   s1 = [[0, 1], [1,3]];
+
+   plot1 = $.jqplot('chart1',[s1],{
+       seriesDefaults: {renderer: $.jqplot.BarRenderer},
+       axes: {
+           xaxis: {
+               renderer: $.jqplot.CategoryAxisRenderer
+           },
+           yaxis: {
+               // autoscale: true,
+               tickOptions: {
+                   formatString: '%d'
+               }
+           }
+       },
+       title: 'Simple Test',
+       legend: {show: true}
+   });
+   
+   s1 = [[0, 1]];
+
+   plot2 = $.jqplot('chart2',[s1],{
+       seriesDefaults: {renderer: $.jqplot.BarRenderer},
+       axes: {
+           xaxis: {
+               renderer: $.jqplot.CategoryAxisRenderer
+           },
+           yaxis: {
+               // autoscale: true,
+               tickOptions: {
+                   formatString: '%d'
+               }
+           }
+       },
+       title: 'Simple Test',
+       legend: {show: true}
+   });
+   
+   s1 = [3,1.5,2,0.5,2,1,2.5];
+
+   plot3 = $.jqplot('chart3',[s1],{
+       axes: {
+           yaxis: {
+               tickOptions: {
+                   formatString: '%d'
+               }
+           }
+       },
+       title: 'Simple Test',
+       legend: {show: true}
+   });
+   
+   s1 = [2.9,1.5,2,0.5,2,1,2.5];
+
+   plot4 = $.jqplot('chart4',[s1],{
+       axes: {
+           yaxis: {
+               tickOptions: {
+                   formatString: '%d'
+               }
+           }
+       },
+       title: 'Simple Test',
+       legend: {show: true}
+   });
+   
+   s1 = [.4,.3,.5,.1,.6,.2];
+
+   plot5 = $.jqplot('chart5',[s1],{
+       axes: {
+           yaxis: {
+               tickOptions: {
+                   formatString: '%d'
+               }
+           }
+       },
+       title: 'Simple Test',
+       legend: {show: true}
+   });
+   
+   s1 = [[0, 1]];
+
+   plot6 = $.jqplot('chart6',[s1],{
+       seriesDefaults: {renderer: $.jqplot.BarRenderer},
+       axes: {
+           xaxis: {
+               renderer: $.jqplot.CategoryAxisRenderer
+           },
+           yaxis: {
+               // autoscale: true,
+               tickOptions: {
+                   formatString: '%d'
+               },
+               tickInterval: 1,
+               min: 0
+           }
+       },
+       title: 'Simple Test',
+       legend: {show: true}
+   });
+   
+ });
+</script>
+  </head>
+  <body>
+<?php include "nav.inc"; ?>
+<p>Tests of enhancements to axis tick generation algorithm.  Axis now checks to see if the tick interval (delta between ticks) is less than the precision of the tick format string.  If it is, it will try to increase the tick interval, number of ticks or change the axis minimum or maximum so that it is at least as great as the tick label precision.</p>
+
+<p>Note, if the user has specified the axis tickInterval, numberTicks, min or max options, the algorithm may not be able to produce the desired ticks.</p>
+
+<p>This helps in situations where the user wants to display ticks formatted as integer values on a plot with a very small range.  For example, a plot with a y axis range from 0 to 2 and 6 ticks will have a tickInterval of 0.4 and ticks like [0, 0.4, 0.8, 1.2, 1.6, 2].  When formatted as integers, the plot displays ticks like [0, 0, 1, 1, 2, 2].  The new algorithm will try to adjust the number of ticks or the axis minimum or maximum to generate ticks like [0, 1, 2].</p>
+
+<div id="chart1" class="plot" style="width:400px;height:300px;"></div>
+<div id="chart2" class="plot" style="width:400px;height:300px;"></div>
+<div id="chart3" class="plot" style="width:400px;height:300px;"></div>
+<div id="chart4" class="plot" style="width:400px;height:300px;"></div>
+<div id="chart5" class="plot" style="width:400px;height:300px;"></div>
+<div id="chart6" class="plot" style="width:400px;height:300px;"></div>
+  </body>
+</html>