| 9 |
lars |
1 |
<!DOCTYPE html>
|
|
|
2 |
|
|
|
3 |
<html>
|
|
|
4 |
<head>
|
|
|
5 |
|
|
|
6 |
<title>Force Plot to Have Tick at 0 or 100</title>
|
|
|
7 |
|
|
|
8 |
<link class="include" rel="stylesheet" type="text/css" href="../jquery.jqplot.min.css" />
|
|
|
9 |
<link rel="stylesheet" type="text/css" href="examples.min.css" />
|
|
|
10 |
<link type="text/css" rel="stylesheet" href="syntaxhighlighter/styles/shCoreDefault.min.css" />
|
|
|
11 |
<link type="text/css" rel="stylesheet" href="syntaxhighlighter/styles/shThemejqPlot.min.css" />
|
|
|
12 |
|
|
|
13 |
<!--[if lt IE 9]><script language="javascript" type="text/javascript" src="../excanvas.js"></script><![endif]-->
|
|
|
14 |
<script class="include" type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
|
|
|
15 |
|
|
|
16 |
|
|
|
17 |
</head>
|
|
|
18 |
<body>
|
|
|
19 |
<div id="header">
|
|
|
20 |
<div class="nav">
|
|
|
21 |
<a class="nav" href="../../../index.php"><span>></span>Home</a>
|
|
|
22 |
<a class="nav" href="../../../docs/"><span>></span>Docs</a>
|
|
|
23 |
<a class="nav" href="../../download/"><span>></span>Download</a>
|
|
|
24 |
<a class="nav" href="../../../info.php"><span>></span>Info</a>
|
|
|
25 |
<a class="nav" href="../../../donate.php"><span>></span>Donate</a>
|
|
|
26 |
</div>
|
|
|
27 |
</div>
|
|
|
28 |
<div class="colmask leftmenu">
|
|
|
29 |
<div class="colleft">
|
|
|
30 |
<div class="col1" id="example-content">
|
|
|
31 |
|
|
|
32 |
|
|
|
33 |
<!-- Example scripts go here -->
|
|
|
34 |
|
|
|
35 |
|
|
|
36 |
<script language="javascript" type="text/javascript">
|
|
|
37 |
|
|
|
38 |
function makeContinuousData(npoints, ybase, yvariation) {
|
|
|
39 |
var data = [];
|
|
|
40 |
if (yvariation == null) {
|
|
|
41 |
yvariation = ybase;
|
|
|
42 |
ybase = (Math.random() - 0.5) * 2 * yvariation;
|
|
|
43 |
}
|
|
|
44 |
for (j=0; j<npoints; j++) {
|
|
|
45 |
data.push([j, ybase]);
|
|
|
46 |
ybase += (Math.random() - 0.5) * 2 * yvariation;
|
|
|
47 |
}
|
|
|
48 |
return data;
|
|
|
49 |
}
|
|
|
50 |
|
|
|
51 |
function makeRandomData(npoints, yvariation) {
|
|
|
52 |
var data = [];
|
|
|
53 |
for (j=0; j<npoints; j++) {
|
|
|
54 |
var y = (Math.random() - 0.5) * 2 * yvariation;
|
|
|
55 |
data.push([j, y]);
|
|
|
56 |
}
|
|
|
57 |
return data;
|
|
|
58 |
}
|
|
|
59 |
function makeDualContinuousData(npoints, xbase, xvariation, ybase, yvariation) {
|
|
|
60 |
var data = [];
|
|
|
61 |
if (ybase == null && yvariation == null) {
|
|
|
62 |
xvariation = xbase;
|
|
|
63 |
yvariation = xvariation;
|
|
|
64 |
xbase = (Math.random() - 0.5) * 2 * xvariation;
|
|
|
65 |
ybase = (Math.random() - 0.5) * 2 * yvariation;
|
|
|
66 |
}
|
|
|
67 |
for (j=0; j<npoints; j++) {
|
|
|
68 |
data.push([xbase, ybase]);
|
|
|
69 |
xbase += (Math.random()) * xvariation;
|
|
|
70 |
ybase += (Math.random() - 0.5) * 2 * yvariation;
|
|
|
71 |
}
|
|
|
72 |
return data;
|
|
|
73 |
}
|
|
|
74 |
|
|
|
75 |
var plotOptions = {
|
|
|
76 |
axes: {
|
|
|
77 |
yaxis: {
|
|
|
78 |
rendererOptions: { forceTickAt0: true, forceTickAt100: true }
|
|
|
79 |
}
|
|
|
80 |
}
|
|
|
81 |
};
|
|
|
82 |
|
|
|
83 |
</script>
|
|
|
84 |
|
|
|
85 |
<script class="code" type="text/javascript">
|
|
|
86 |
$(document).ready(function(){
|
|
|
87 |
plot1 = $.jqplot('chart1',[makeContinuousData(100, 55)], {});
|
|
|
88 |
});
|
|
|
89 |
</script>
|
|
|
90 |
|
|
|
91 |
<script class="code" type="text/javascript">
|
|
|
92 |
$(document).ready(function(){
|
|
|
93 |
plot2 = $.jqplot('chart2',[makeContinuousData(100, 1, 0.001)], {});
|
|
|
94 |
});
|
|
|
95 |
</script>
|
|
|
96 |
|
|
|
97 |
<script class="code" type="text/javascript">
|
|
|
98 |
$(document).ready(function(){
|
|
|
99 |
plot3 = $.jqplot('chart3',[makeContinuousData(20, 40, 5)], {
|
|
|
100 |
axes: {
|
|
|
101 |
yaxis: {
|
|
|
102 |
rendererOptions: { forceTickAt0: true, forceTickAt100: true }
|
|
|
103 |
}
|
|
|
104 |
}
|
|
|
105 |
});
|
|
|
106 |
});
|
|
|
107 |
</script>
|
|
|
108 |
|
|
|
109 |
<script class="code" type="text/javascript">
|
|
|
110 |
$(document).ready(function(){
|
|
|
111 |
plot4 = $.jqplot('chart4',[makeContinuousData(20, 40, 5)], {
|
|
|
112 |
axesDefaults: {
|
|
|
113 |
pad: 0
|
|
|
114 |
},
|
|
|
115 |
axes: {
|
|
|
116 |
yaxis: {
|
|
|
117 |
rendererOptions: { forceTickAt0: true, forceTickAt100: true }
|
|
|
118 |
}
|
|
|
119 |
}
|
|
|
120 |
});
|
|
|
121 |
});
|
|
|
122 |
</script>
|
|
|
123 |
|
|
|
124 |
<script class="code" type="text/javascript">
|
|
|
125 |
$(document).ready(function(){
|
|
|
126 |
plot5 = $.jqplot('chart5',[makeContinuousData(20, 40, 5)], {
|
|
|
127 |
axes: {
|
|
|
128 |
xaxis: {
|
|
|
129 |
padMin: 0,
|
|
|
130 |
padMax: 1.2
|
|
|
131 |
},
|
|
|
132 |
yaxis: {
|
|
|
133 |
padMax: 0,
|
|
|
134 |
rendererOptions: { forceTickAt0: true, forceTickAt100: true }
|
|
|
135 |
}
|
|
|
136 |
}
|
|
|
137 |
});
|
|
|
138 |
});
|
|
|
139 |
</script>
|
|
|
140 |
|
|
|
141 |
<script class="code" type="text/javascript">
|
|
|
142 |
$(document).ready(function(){
|
|
|
143 |
plot6 = $.jqplot('chart6',[makeContinuousData(20, 40, 8)], {
|
|
|
144 |
axes: {
|
|
|
145 |
yaxis: {
|
|
|
146 |
rendererOptions: { forceTickAt0: true, forceTickAt100: true }
|
|
|
147 |
}
|
|
|
148 |
},
|
|
|
149 |
canvasOverlay: {
|
|
|
150 |
show: true,
|
|
|
151 |
objects: [
|
|
|
152 |
{horizontalLine: {
|
|
|
153 |
name: 'pebbles',
|
|
|
154 |
y: 0,
|
|
|
155 |
lineWidth: 3,
|
|
|
156 |
color: 'rgb(100, 55, 124)',
|
|
|
157 |
shadow: true,
|
|
|
158 |
lineCap: 'butt',
|
|
|
159 |
xOffset: 0
|
|
|
160 |
}},
|
|
|
161 |
{dashedHorizontalLine: {
|
|
|
162 |
name: 'bam-bam',
|
|
|
163 |
y: 100,
|
|
|
164 |
lineWidth: 4,
|
|
|
165 |
dashPattern: [8, 16],
|
|
|
166 |
lineCap: 'round',
|
|
|
167 |
xOffset: '25',
|
|
|
168 |
color: 'rgb(66, 98, 144)',
|
|
|
169 |
shadow: false
|
|
|
170 |
}}
|
|
|
171 |
]
|
|
|
172 |
}
|
|
|
173 |
});
|
|
|
174 |
});
|
|
|
175 |
|
|
|
176 |
function lineup(plot, name) {
|
|
|
177 |
var co = plot.plugins.canvasOverlay;
|
|
|
178 |
var line = co.get(name);
|
|
|
179 |
line.options.y += 5;
|
|
|
180 |
co.draw(plot);
|
|
|
181 |
}
|
|
|
182 |
|
|
|
183 |
function linedown(plot, name) {
|
|
|
184 |
var co = plot.plugins.canvasOverlay;
|
|
|
185 |
var line = co.get(name);
|
|
|
186 |
line.options.y -= 5;
|
|
|
187 |
co.draw(plot);
|
|
|
188 |
}
|
|
|
189 |
|
|
|
190 |
</script>
|
|
|
191 |
|
|
|
192 |
<div id="chart1" style="height:300px; width:600px;margin: 30px;"></div>
|
|
|
193 |
<pre class="code brush: js"></pre>
|
|
|
194 |
<div id="chart2" style="height:300px; width:600px;margin: 30px;"></div>
|
|
|
195 |
<pre class="code brush: js"></pre>
|
|
|
196 |
<div id="chart3" style="height:300px; width:600px;margin: 30px;"></div>
|
|
|
197 |
<pre class="code brush: js"></pre>
|
|
|
198 |
<div id="chart4" style="height:300px; width:600px;margin: 30px;"></div>
|
|
|
199 |
<pre class="code brush: js"></pre>
|
|
|
200 |
<div id="chart5" style="height:300px; width:600px;margin: 30px;"></div>
|
|
|
201 |
<pre class="code brush: js"></pre>
|
|
|
202 |
<div id="chart6" style="height:300px; width:600px;margin: 30px;"></div>
|
|
|
203 |
|
|
|
204 |
<div>
|
|
|
205 |
<button onclick="lineup(plot6, 'pebbles')"> Pebbles Up </button>
|
|
|
206 |
<button onclick="linedown(plot6, 'pebbles')"> Pebbles Down </button>
|
|
|
207 |
</div>
|
|
|
208 |
<div>
|
|
|
209 |
<button onclick="lineup(plot6, 'bam-bam')">Bam-Bam Up</button>
|
|
|
210 |
<button onclick="linedown(plot6, 'bam-bam')">Bam-Bam Down</button>
|
|
|
211 |
</div>
|
|
|
212 |
|
|
|
213 |
<pre class="code brush: js"></pre>
|
|
|
214 |
|
|
|
215 |
<!-- End example scripts -->
|
|
|
216 |
|
|
|
217 |
<!-- Don't touch this! -->
|
|
|
218 |
|
|
|
219 |
|
|
|
220 |
<script class="include" type="text/javascript" src="../jquery.jqplot.min.js"></script>
|
|
|
221 |
<script type="text/javascript" src="syntaxhighlighter/scripts/shCore.min.js"></script>
|
|
|
222 |
<script type="text/javascript" src="syntaxhighlighter/scripts/shBrushJScript.min.js"></script>
|
|
|
223 |
<script type="text/javascript" src="syntaxhighlighter/scripts/shBrushXml.min.js"></script>
|
|
|
224 |
<!-- Additional plugins go here -->
|
|
|
225 |
|
|
|
226 |
<script class="include" type="text/javascript" src="../plugins/jqplot.canvasAxisTickRenderer.min.js"></script>
|
|
|
227 |
<script class="include" type="text/javascript" src="../plugins/jqplot.canvasTextRenderer.min.js"></script>
|
|
|
228 |
<script class="include" type="text/javascript" src="../plugins/jqplot.canvasOverlay.min.js"></script>
|
|
|
229 |
|
|
|
230 |
<!-- End additional plugins -->
|
|
|
231 |
|
|
|
232 |
</div>
|
|
|
233 |
<div class="col2">
|
|
|
234 |
|
|
|
235 |
<div class="example-link"><a class="example-link" href="data-renderers.html">AJAX and JSON Data Loading via Data Renderers</a></div>
|
|
|
236 |
<div class="example-link"><a class="example-link" href="barLineAnimated.html">Animated Charts</a></div>
|
|
|
237 |
<div class="example-link"><a class="example-link" href="dashboardWidget.html">Animated Dashboard Sample - Filled Line with Log Axis</a></div>
|
|
|
238 |
<div class="example-link"><a class="example-link" href="kcp_area.html">Area Chart</a></div>
|
|
|
239 |
<div class="example-link"><a class="example-link" href="kcp_area2.html">Area Chart 2</a></div>
|
|
|
240 |
<div class="example-link"><a class="example-link" href="axisLabelTests.html">Axis Labels</a></div>
|
|
|
241 |
<div class="example-link"><a class="example-link" href="axisLabelsRotatedText.html">Axis Labels and Rotated Text</a></div>
|
|
|
242 |
<div class="example-link"><a class="example-link" href="barTest.html">Bar Charts</a></div>
|
|
|
243 |
<div class="example-link"><a class="example-link" href="multipleBarColors.html">Bar Colors Example</a></div>
|
|
|
244 |
<div class="example-link"><a class="example-link" href="bezierCurve.html">Bezier Curve Plots</a></div>
|
|
|
245 |
<div class="example-link"><a class="example-link" href="blockPlot.html">Block Plots</a></div>
|
|
|
246 |
<div class="example-link"><a class="example-link" href="bubbleChart.html">Bubble Charts</a></div>
|
|
|
247 |
<div class="example-link"><a class="example-link" href="bubble-plots.html">Bubble Plots</a></div>
|
|
|
248 |
<div class="example-link"><a class="example-link" href="candlestick.html">Candlestick and Open Hi Low Close Charts</a></div>
|
|
|
249 |
<div class="example-link"><a class="example-link" href="theming.html">Chart Theming</a></div>
|
|
|
250 |
<div class="example-link"><a class="example-link" href="fillBetweenLines.html">Charts with Fill Between Lines</a></div>
|
|
|
251 |
<div class="example-link"><a class="example-link" href="kcp_cdf.html">Cumulative Density Function Chart</a></div>
|
|
|
252 |
<div class="example-link"><a class="example-link" href="dashedLines.html">Dashed Lines with Smoothing</a></div>
|
|
|
253 |
<div class="example-link"><a class="example-link" href="cursor-highlighter.html">Data Point Highlighting, Tooltips and Cursor Tracking</a></div>
|
|
|
254 |
<div class="example-link"><a class="example-link" href="point-labels.html">Data Point labels</a></div>
|
|
|
255 |
<div class="example-link"><a class="example-link" href="date-axes.html">Date Axes</a></div>
|
|
|
256 |
<div class="example-link"><a class="example-link" href="dateAxisRenderer.html">Date Axes 2</a></div>
|
|
|
257 |
<div class="example-link"><a class="example-link" href="rotatedTickLabelsZoom.html">Date Axes, Rotated Labels and Zooming</a></div>
|
|
|
258 |
<div class="example-link"><a class="example-link" href="canvas-overlay.html">Draw Lines on Plots - Canvas Overlay</a></div>
|
|
|
259 |
<div class="example-link"><a class="example-link" href="draw-rectangles.html">Draw Rectangles on Plots</a></div>
|
|
|
260 |
<div class="example-link"><a class="example-link" href="kcp_engel.html">Engel Curves</a></div>
|
|
|
261 |
<div class="example-link"><a class="example-link" href="bandedLine.html">Error Bands and Confidence Intervals</a></div>
|
|
|
262 |
<div class="example-link"><a class="example-link" href="area.html">Filled (Area) Charts</a></div>
|
|
|
263 |
<div class="example-link"><a class="example-link" href="axisScalingForceTickAt.html">Force Plot to Have Tick at 0 or 100</a></div>
|
|
|
264 |
<div class="example-link"><a class="example-link" href="hiddenPlotsInTabs.html">Hidden Plots</a></div>
|
|
|
265 |
<div class="example-link"><a class="example-link" href="customHighlighterCursorTrendline.html">Highlighting, Dragging Points, Cursor and Trend Lines</a></div>
|
|
|
266 |
<div class="example-link"><a class="example-link" href="line-charts.html">Line Charts and Options</a></div>
|
|
|
267 |
<div class="example-link"><a class="example-link" href="kcp_lorenz.html">Lorenz Curves</a></div>
|
|
|
268 |
<div class="example-link"><a class="example-link" href="mekkoCharts.html">Mekko Charts</a></div>
|
|
|
269 |
<div class="example-link"><a class="example-link" href="meterGauge.html">Meter Gauge</a></div>
|
|
|
270 |
<div class="example-link"><a class="example-link" href="candlestick-charts.html">Open Hi Low Close and Candlestick Charts</a></div>
|
|
|
271 |
<div class="example-link"><a class="example-link" href="pieTest.html">Pie Charts and Options</a></div>
|
|
|
272 |
<div class="example-link"><a class="example-link" href="pieTest4.html">Pie Charts and Options 2</a></div>
|
|
|
273 |
<div class="example-link"><a class="example-link" href="pie-donut-charts.html">Pie and Donut Charts</a></div>
|
|
|
274 |
<div class="example-link"><a class="example-link" href="selectorSyntax.html">Plot Creation with jQuery Selectors</a></div>
|
|
|
275 |
<div class="example-link"><a class="example-link" href="zooming.html">Plot Zooming and Cursor Control</a></div>
|
|
|
276 |
<div class="example-link"><a class="example-link" href="kcp_pdf.html">Probability Density Function Chart</a></div>
|
|
|
277 |
<div class="example-link"><a class="example-link" href="kcp_pyramid_by_age.html">Pyramid Chart By Age</a></div>
|
|
|
278 |
<div class="example-link"><a class="example-link" href="kcp_pyramid.html">Pyramid Charts</a></div>
|
|
|
279 |
<div class="example-link"><a class="example-link" href="kcp_pyramid2.html">Pyramid Charts 2</a></div>
|
|
|
280 |
<div class="example-link"><a class="example-link" href="kcp_quintiles.html">Quintile Pyramid Charts</a></div>
|
|
|
281 |
<div class="example-link"><a class="example-link" href="resizablePlot.html">Resizable Plots</a></div>
|
|
|
282 |
<div class="example-link"><a class="example-link" href="rotated-tick-labels.html">Rotated Labels and Font Styling</a></div>
|
|
|
283 |
<div class="example-link"><a class="example-link" href="smoothedLine.html">Smoothed Lines</a></div>
|
|
|
284 |
<div class="example-link"><a class="example-link" href="bar-charts.html">Vertical and Horizontal Bar Charts</a></div>
|
|
|
285 |
<div class="example-link"><a class="example-link" href="waterfall.html">Waterfall Charts</a></div>
|
|
|
286 |
<div class="example-link"><a class="example-link" href="waterfall2.html">Waterfall Charts 2</a></div>
|
|
|
287 |
<div class="example-link"><a class="example-link" href="zoomOptions.html">Zoom Options</a></div>
|
|
|
288 |
<div class="example-link"><a class="example-link" href="zoomProxy.html">Zoom Proxy - Control one plot from another</a></div>
|
|
|
289 |
<div class="example-link"><a class="example-link" href="zoom1.html">Zooming</a></div>
|
|
|
290 |
<div class="example-link"><a class="example-link" href="dateAxisLogAxisZooming.html">Zooming with Date and Log Axes</a></div>
|
|
|
291 |
|
|
|
292 |
</div>
|
|
|
293 |
</div>
|
|
|
294 |
</div>
|
|
|
295 |
<script type="text/javascript" src="example.min.js"></script>
|
|
|
296 |
|
|
|
297 |
</body>
|
|
|
298 |
|
|
|
299 |
|
|
|
300 |
</html>
|