Subversion-Projekte lars-tiefland.cienc

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
9 lars 1
<!DOCTYPE html>
2
 
3
<html>
4
<head>
5
 
6
    <title>Vertical and Horizontal Bar Charts</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>&gt;</span>Home</a>
22
            <a class="nav"  href="../../../docs/"><span>&gt;</span>Docs</a>
23
            <a class="nav"  href="../../download/"><span>&gt;</span>Download</a>
24
            <a class="nav" href="../../../info.php"><span>&gt;</span>Info</a>
25
            <a class="nav"  href="../../../donate.php"><span>&gt;</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
  <style type="text/css">
37
 
38
    .note {
39
        font-size: 0.8em;
40
    }
41
    .jqplot-yaxis-tick {
42
      white-space: nowrap;
43
    }
44
  </style>
45
 
46
    <div id="chart1" style="width:600px; height:250px;"></div>
47
 
48
    <pre class="code brush: js"></pre>
49
 
50
    <div id="chart2" style="width:400px; height:300px;"></div>
51
 
52
    <pre class="code brush: js"></pre>
53
 
54
    <p class="text">Click on a bar in the plot below to update the text box.</p>
55
    <p class="text">You Clicked:
56
    <span id="info3">Nothing yet.</span>
57
    </p>
58
    <div id="chart3" style="width:400px; height:300px;"></div>
59
 
60
    <pre class="code brush: js"></pre>
61
 
62
  <script class="code" type="text/javascript">
63
$(document).ready(function(){
64
    var s1 = [200, 600, 700, 1000];
65
    var s2 = [460, -210, 690, 820];
66
    var s3 = [-260, -440, 320, 200];
67
    // Can specify a custom tick Array.
68
    // Ticks should match up one for each y value (category) in the series.
69
    var ticks = ['May', 'June', 'July', 'August'];
70
 
71
    var plot1 = $.jqplot('chart1', [s1, s2, s3], {
72
        // The "seriesDefaults" option is an options object that will
73
        // be applied to all series in the chart.
74
        seriesDefaults:{
75
            renderer:$.jqplot.BarRenderer,
76
            rendererOptions: {fillToZero: true}
77
        },
78
        // Custom labels for the series are specified with the "label"
79
        // option on the series option.  Here a series option object
80
        // is specified for each series.
81
        series:[
82
            {label:'Hotel'},
83
            {label:'Event Regristration'},
84
            {label:'Airfare'}
85
        ],
86
        // Show the legend and put it outside the grid, but inside the
87
        // plot container, shrinking the grid to accomodate the legend.
88
        // A value of "outside" would not shrink the grid and allow
89
        // the legend to overflow the container.
90
        legend: {
91
            show: true,
92
            placement: 'outsideGrid'
93
        },
94
        axes: {
95
            // Use a category axis on the x axis and use our custom ticks.
96
            xaxis: {
97
                renderer: $.jqplot.CategoryAxisRenderer,
98
                ticks: ticks
99
            },
100
            // Pad the y axis just a little so bars can get close to, but
101
            // not touch, the grid boundaries.  1.2 is the default padding.
102
            yaxis: {
103
                pad: 1.05,
104
                tickOptions: {formatString: '$%d'}
105
            }
106
        }
107
    });
108
});
109
  </script>
110
 
111
 
112
<script class="code" type="text/javascript">
113
$(document).ready(function(){
114
    // For horizontal bar charts, x an y values must will be "flipped"
115
    // from their vertical bar counterpart.
116
    var plot2 = $.jqplot('chart2', [
117
        [[2,1], [4,2], [6,3], [3,4]],
118
        [[5,1], [1,2], [3,3], [4,4]],
119
        [[4,1], [7,2], [1,3], [2,4]]], {
120
        seriesDefaults: {
121
            renderer:$.jqplot.BarRenderer,
122
            // Show point labels to the right ('e'ast) of each bar.
123
            // edgeTolerance of -15 allows labels flow outside the grid
124
            // up to 15 pixels.  If they flow out more than that, they
125
            // will be hidden.
126
            pointLabels: { show: true, location: 'e', edgeTolerance: -15 },
127
            // Rotate the bar shadow as if bar is lit from top right.
128
            shadowAngle: 135,
129
            // Here's where we tell the chart it is oriented horizontally.
130
            rendererOptions: {
131
                barDirection: 'horizontal'
132
            }
133
        },
134
        axes: {
135
            yaxis: {
136
                renderer: $.jqplot.CategoryAxisRenderer
137
            }
138
        }
139
    });
140
});
141
</script>
142
 
143
<script class="code" type="text/javascript">
144
$(document).ready(function(){
145
  var s1 = [2, 6, 7, 10];
146
  var s2 = [7, 5, 3, 4];
147
  var s3 = [14, 9, 3, 8];
148
  plot3 = $.jqplot('chart3', [s1, s2, s3], {
149
    // Tell the plot to stack the bars.
150
    stackSeries: true,
151
    captureRightClick: true,
152
    seriesDefaults:{
153
      renderer:$.jqplot.BarRenderer,
154
      rendererOptions: {
155
          // Put a 30 pixel margin between bars.
156
          barMargin: 30,
157
          // Highlight bars when mouse button pressed.
158
          // Disables default highlighting on mouse over.
159
          highlightMouseDown: true
160
      },
161
      pointLabels: {show: true}
162
    },
163
    axes: {
164
      xaxis: {
165
          renderer: $.jqplot.CategoryAxisRenderer
166
      },
167
      yaxis: {
168
        // Don't pad out the bottom of the data range.  By default,
169
        // axes scaled as if data extended 10% above and below the
170
        // actual range to prevent data points right on grid boundaries.
171
        // Don't want to do that here.
172
        padMin: 0
173
      }
174
    },
175
    legend: {
176
      show: true,
177
      location: 'e',
178
      placement: 'outside'
179
    }
180
  });
181
  // Bind a listener to the "jqplotDataClick" event.  Here, simply change
182
  // the text of the info3 element to show what series and ponit were
183
  // clicked along with the data for that point.
184
  $('#chart3').bind('jqplotDataClick',
185
    function (ev, seriesIndex, pointIndex, data) {
186
      $('#info3').html('series: '+seriesIndex+', point: '+pointIndex+', data: '+data);
187
    }
188
  );
189
});
190
</script>
191
 
192
<!-- End example scripts -->
193
 
194
<!-- Don't touch this! -->
195
 
196
 
197
    <script class="include" type="text/javascript" src="../jquery.jqplot.min.js"></script>
198
    <script type="text/javascript" src="syntaxhighlighter/scripts/shCore.min.js"></script>
199
    <script type="text/javascript" src="syntaxhighlighter/scripts/shBrushJScript.min.js"></script>
200
    <script type="text/javascript" src="syntaxhighlighter/scripts/shBrushXml.min.js"></script>
201
<!-- End Don't touch this! -->
202
 
203
<!-- Additional plugins go here -->
204
 
205
    <script class="include" language="javascript" type="text/javascript" src="../plugins/jqplot.barRenderer.min.js"></script>
206
    <script class="include" language="javascript" type="text/javascript" src="../plugins/jqplot.categoryAxisRenderer.min.js"></script>
207
    <script class="include" language="javascript" type="text/javascript" src="../plugins/jqplot.pointLabels.min.js"></script>
208
 
209
<!-- End additional plugins -->
210
 
211
        </div>
212
         <div class="col2">
213
 
214
           <div class="example-link"><a class="example-link" href="data-renderers.html">AJAX and JSON Data Loading via Data Renderers</a></div>
215
           <div class="example-link"><a class="example-link" href="barLineAnimated.html">Animated Charts</a></div>
216
           <div class="example-link"><a class="example-link" href="dashboardWidget.html">Animated Dashboard Sample - Filled Line with Log Axis</a></div>
217
           <div class="example-link"><a class="example-link" href="kcp_area.html">Area Chart</a></div>
218
           <div class="example-link"><a class="example-link" href="kcp_area2.html">Area Chart 2</a></div>
219
           <div class="example-link"><a class="example-link" href="axisLabelTests.html">Axis Labels</a></div>
220
           <div class="example-link"><a class="example-link" href="axisLabelsRotatedText.html">Axis Labels and Rotated Text</a></div>
221
           <div class="example-link"><a class="example-link" href="barTest.html">Bar Charts</a></div>
222
           <div class="example-link"><a class="example-link" href="multipleBarColors.html">Bar Colors Example</a></div>
223
           <div class="example-link"><a class="example-link" href="bezierCurve.html">Bezier Curve Plots</a></div>
224
           <div class="example-link"><a class="example-link" href="blockPlot.html">Block Plots</a></div>
225
           <div class="example-link"><a class="example-link" href="bubbleChart.html">Bubble Charts</a></div>
226
           <div class="example-link"><a class="example-link" href="bubble-plots.html">Bubble Plots</a></div>
227
           <div class="example-link"><a class="example-link" href="candlestick.html">Candlestick and Open Hi Low Close Charts</a></div>
228
           <div class="example-link"><a class="example-link" href="theming.html">Chart Theming</a></div>
229
           <div class="example-link"><a class="example-link" href="fillBetweenLines.html">Charts with Fill Between Lines</a></div>
230
           <div class="example-link"><a class="example-link" href="kcp_cdf.html">Cumulative Density Function Chart</a></div>
231
           <div class="example-link"><a class="example-link" href="dashedLines.html">Dashed Lines with Smoothing</a></div>
232
           <div class="example-link"><a class="example-link" href="cursor-highlighter.html">Data Point Highlighting, Tooltips and Cursor Tracking</a></div>
233
           <div class="example-link"><a class="example-link" href="point-labels.html">Data Point labels</a></div>
234
           <div class="example-link"><a class="example-link" href="date-axes.html">Date Axes</a></div>
235
           <div class="example-link"><a class="example-link" href="dateAxisRenderer.html">Date Axes 2</a></div>
236
           <div class="example-link"><a class="example-link" href="rotatedTickLabelsZoom.html">Date Axes, Rotated Labels and Zooming</a></div>
237
           <div class="example-link"><a class="example-link" href="canvas-overlay.html">Draw Lines on Plots - Canvas Overlay</a></div>
238
           <div class="example-link"><a class="example-link" href="draw-rectangles.html">Draw Rectangles on Plots</a></div>
239
           <div class="example-link"><a class="example-link" href="kcp_engel.html">Engel Curves</a></div>
240
           <div class="example-link"><a class="example-link" href="bandedLine.html">Error Bands and Confidence Intervals</a></div>
241
           <div class="example-link"><a class="example-link" href="area.html">Filled (Area) Charts</a></div>
242
           <div class="example-link"><a class="example-link" href="axisScalingForceTickAt.html">Force Plot to Have Tick at 0 or 100</a></div>
243
           <div class="example-link"><a class="example-link" href="hiddenPlotsInTabs.html">Hidden Plots</a></div>
244
           <div class="example-link"><a class="example-link" href="customHighlighterCursorTrendline.html">Highlighting, Dragging Points, Cursor and Trend Lines</a></div>
245
           <div class="example-link"><a class="example-link" href="line-charts.html">Line Charts and Options</a></div>
246
           <div class="example-link"><a class="example-link" href="kcp_lorenz.html">Lorenz Curves</a></div>
247
           <div class="example-link"><a class="example-link" href="mekkoCharts.html">Mekko Charts</a></div>
248
           <div class="example-link"><a class="example-link" href="meterGauge.html">Meter Gauge</a></div>
249
           <div class="example-link"><a class="example-link" href="candlestick-charts.html">Open Hi Low Close and Candlestick Charts</a></div>
250
           <div class="example-link"><a class="example-link" href="pieTest.html">Pie Charts and Options</a></div>
251
           <div class="example-link"><a class="example-link" href="pieTest4.html">Pie Charts and Options 2</a></div>
252
           <div class="example-link"><a class="example-link" href="pie-donut-charts.html">Pie and Donut Charts</a></div>
253
           <div class="example-link"><a class="example-link" href="selectorSyntax.html">Plot Creation with jQuery Selectors</a></div>
254
           <div class="example-link"><a class="example-link" href="zooming.html">Plot Zooming and Cursor Control</a></div>
255
           <div class="example-link"><a class="example-link" href="kcp_pdf.html">Probability Density Function Chart</a></div>
256
           <div class="example-link"><a class="example-link" href="kcp_pyramid_by_age.html">Pyramid Chart By Age</a></div>
257
           <div class="example-link"><a class="example-link" href="kcp_pyramid.html">Pyramid Charts</a></div>
258
           <div class="example-link"><a class="example-link" href="kcp_pyramid2.html">Pyramid Charts 2</a></div>
259
           <div class="example-link"><a class="example-link" href="kcp_quintiles.html">Quintile Pyramid Charts</a></div>
260
           <div class="example-link"><a class="example-link" href="resizablePlot.html">Resizable Plots</a></div>
261
           <div class="example-link"><a class="example-link" href="rotated-tick-labels.html">Rotated Labels and Font Styling</a></div>
262
           <div class="example-link"><a class="example-link" href="smoothedLine.html">Smoothed Lines</a></div>
263
           <div class="example-link"><a class="example-link" href="bar-charts.html">Vertical and Horizontal Bar Charts</a></div>
264
           <div class="example-link"><a class="example-link" href="waterfall.html">Waterfall Charts</a></div>
265
           <div class="example-link"><a class="example-link" href="waterfall2.html">Waterfall Charts 2</a></div>
266
           <div class="example-link"><a class="example-link" href="zoomOptions.html">Zoom Options</a></div>
267
           <div class="example-link"><a class="example-link" href="zoomProxy.html">Zoom Proxy - Control one plot from another</a></div>
268
           <div class="example-link"><a class="example-link" href="zoom1.html">Zooming</a></div>
269
           <div class="example-link"><a class="example-link" href="dateAxisLogAxisZooming.html">Zooming with Date and Log Axes</a></div>
270
 
271
         </div>
272
               </div>
273
    </div>
274
    <script type="text/javascript" src="example.min.js"></script>
275
 
276
</body>
277
 
278
 
279
</html>