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>Bubble 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
  <style type="text/css">
36
    .jqplot-target {
37
        margin-bottom: 2em;
38
    }
39
 
40
    .note {
41
        font-size: 0.8em;
42
    }
43
 
44
    #tooltip1b {
45
        font-size: 12px;
46
        color: rgb(15%, 15%, 15%);
47
        padding:2px;
48
        background-color: rgba(95%, 95%, 95%, 0.8);
49
    }
50
 
51
    #legend1b {
52
        font-size: 12px;
53
        border: 1px solid #cdcdcd;
54
        border-collapse: collapse;
55
    }
56
    #legend1b td, #legend1b th {
57
        border: 1px solid #cdcdcd;
58
        padding: 1px 4px;
59
    }
60
  </style>
61
 
62
 
63
 <p>Bubble charts represent 3 dimensional data.  Data is passed in to a bubble chart as a series of [x, y, radius, &lt;label or object&gt;].  The optional fourth element of the data point can either be either a label string or an object having 'label' and/or 'color' properties to assign to the bubble.</p>
64
 
65
<p>By default, all bubbles are scaled according to the size of the plot area.  The radius value in the data point will be adjusted to fit the bubbles in the chart.  If the "autoscaleBubbles" option is set to false, the radius value in the data will be taken as a literal pixel value for the radius of the points.</p>
66
 
67
<p>The below chart show basic customization of bubble appearance with the "bubbleAlpha" and "highlightAlpha" options.</p>
68
 
69
<div id="chart1" class="plot" style="width:460px;height:340px;"></div>
70
<pre class="code brush:js"></pre>
71
 
72
<div style="position:absolute;z-index:99;display:none;" id="tooltip1b"></div>
73
 
74
<table><tr>
75
    <td><div id="chart1b" class="plot" style="width:460px;height:340px;"></div></td>
76
    <td><div style="height:340px;"><table id="legend1b"><tr><th>Company</th><th>R Value</th></tr></table></div></td>
77
</tr></table>
78
<pre class="code brush:js"></pre>
79
 
80
<p>Below is a basic bubble chart showing usage of the optional label and color properties passed in with the data.</p>
81
 
82
<div id="chart1c" class="plot" style="width:460px;height:340px;"></div>
83
<pre class="code brush:js"></pre>
84
 
85
<p>The next chart uses the "bubbleGradients: true" option to specify gradient fills on the bubbles.  Radial gradients are not supported in IE<sup>*</sup> and will be automatically disabled.</p>
86
 
87
<div id="chart2" class="plot" style="width:460px;height:340px;"></div>
88
 
89
<p class="note"><sup>*</sup>Radial gradients are not supported in IE 7 and IE 8 because they are not supported in the excanvas emulation layer used by jqPlot to render charts in IE 7 and IE 8.  jqPlot renders charts using the HTML canvas element which is supported by nearly every browser including IE 9.  Excanvas translates the canvas rendering to VML rendering for IE 7 and 8, but unfortunately does not properly handle radial gradients.</p>
90
 
91
<pre class="code brush:js"></pre>
92
 
93
<p>The following bubble chart shows the "autoscalePointsFactor" and "autoscaleMultiplier" options which can be used to control bubble scaling.  The "autoscalePointsFactor" options controls bubble scaling with the number of points on the plot.  A negative value will decrease bubble size and number of bubbles increases.  The "autoscaleMultiplier" will makes all bubbles larger or smaller for values greater  or less than 1.0.</p>
94
 
95
<p>This chart also demonstrates some of the highlighting options.  Bubble highlighting is controlled with the "highlightMouseOver" and "highlightMouseDown" boolean options.  Here the "highlightMouseDown: true" option is set which causes the plot to highlight on mousedown (click).  This automatically sets the "highlightMouseOver" option to false.</p>
96
 
97
<p>Events are also trigger with plot interaction.  Specifically, "jqplotDataHighlight", "jqplotDataUnhighlight", "jqplotDataClick" and "jqplotDataRightClick" events are triggered.  Handlers are passed an event object, the series index, the point index, and the bubble data.</p>
98
 
99
<div id="chart3" class="plot" style="width:600px;height:400px;"></div>
100
<pre class="code brush:js"></pre>
101
 
102
<script class="code" language="javascript" type="text/javascript">$(document).ready(function(){
103
 
104
    var arr = [[11, 123, 1236, "Acura"], [45, 92, 1067, "Alfa Romeo"],
105
    [24, 104, 1176, "AM General"], [50, 23, 610, "Aston Martin Lagonda"],
106
    [18, 17, 539, "Audi"], [7, 89, 864, "BMW"], [2, 13, 1026, "Bugatti"]];
107
 
108
    plot1 = $.jqplot('chart1',[arr],{
109
        title: 'Transparent Bubbles',
110
        seriesDefaults:{
111
            renderer: $.jqplot.BubbleRenderer,
112
            rendererOptions: {
113
                bubbleAlpha: 0.6,
114
                highlightAlpha: 0.8
115
            },
116
            shadow: true,
117
            shadowAlpha: 0.05
118
        }
119
    });
120
});</script>
121
 
122
<script class="code" language="javascript" type="text/javascript">$(document).ready(function(){
123
 
124
    var arr = [[11, 123, 1236, "Acura"], [45, 92, 1067, "Alfa Romeo"],
125
    [24, 104, 1176, "AM General"], [50, 23, 610, "Aston Martin Lagonda"],
126
    [18, 17, 539, "Audi"], [7, 89, 864, "BMW"], [2, 13, 1026, "Bugatti"]];
127
 
128
    plot1b = $.jqplot('chart1b',[arr],{
129
        title: 'Tooltip and Custom Legend Highlighting',
130
        seriesDefaults:{
131
            renderer: $.jqplot.BubbleRenderer,
132
            rendererOptions: {
133
                bubbleAlpha: 0.6,
134
                highlightAlpha: 0.8,
135
                showLabels: false
136
            },
137
            shadow: true,
138
            shadowAlpha: 0.05
139
        }
140
    });
141
 
142
    // Legend is a simple table in the html.
143
    // Now populate it with the labels from each data value.
144
    $.each(arr, function(index, val) {
145
        $('#legend1b').append('<tr><td>'+val[3]+'</td><td>'+val[2]+'</td></tr>');
146
    });
147
 
148
    // Now bind function to the highlight event to show the tooltip
149
    // and highlight the row in the legend.
150
    $('#chart1b').bind('jqplotDataHighlight',
151
        function (ev, seriesIndex, pointIndex, data, radius) {
152
            var chart_left = $('#chart1b').offset().left,
153
                chart_top = $('#chart1b').offset().top,
154
                x = plot1b.axes.xaxis.u2p(data[0]),  // convert x axis unita to pixels on grid
155
                y = plot1b.axes.yaxis.u2p(data[1]);  // convert y axis units to pixels on grid
156
            var color = 'rgb(50%,50%,100%)';
157
            $('#tooltip1b').css({left:chart_left+x+radius+5, top:chart_top+y});
158
            $('#tooltip1b').html('<span style="font-size:14px;font-weight:bold;color:'+color+';">' +
159
            data[3] + '</span><br />' + 'x: '+data[0] + '<br />' + 'y: ' +
160
            data[1] + '<br />' + 'r: ' + data[2]);
161
            $('#tooltip1b').show();
162
            $('#legend1b tr').css('background-color', '#ffffff');
163
            $('#legend1b tr').eq(pointIndex+1).css('background-color', color);
164
        });
165
 
166
    // Bind a function to the unhighlight event to clean up after highlighting.
167
    $('#chart1b').bind('jqplotDataUnhighlight',
168
        function (ev, seriesIndex, pointIndex, data) {
169
            $('#tooltip1b').empty();
170
            $('#tooltip1b').hide();
171
            $('#legend1b tr').css('background-color', '#ffffff');
172
        });
173
});</script>
174
 
175
<script class="code" language="javascript" type="text/javascript">$(document).ready(function(){
176
 
177
    var arr = [[11, 123, 1236, {label:"Acura", color:'sandybrown'}],
178
    [45, 92, 1067, {label:"Alfa Romeo", color:'skyblue'}],
179
    [24, 104, 1176, {label:"AM General", color:"salmon"}], [50, 23, 610, {color:"papayawhip"}],
180
    [18, 17, 539, "Audi"], [7, 89, 864], [2, 13, 1026, "Bugatti"]];
181
 
182
    plot1c = $.jqplot('chart1c',[arr],{
183
        title: 'Bubble Data Customizations',
184
        seriesDefaults:{
185
            renderer: $.jqplot.BubbleRenderer
186
        }
187
    });
188
 
189
});</script>
190
 
191
<script class="code" language="javascript" type="text/javascript">$(document).ready(function(){
192
 
193
    var arr = [[11, 123, 1236, "Acura"], [45, 92, 1067, "Alfa Romeo"],
194
    [24, 104, 1176, "AM General"], [50, 23, 610, "Aston Martin Lagonda"],
195
    [18, 17, 539, "Audi"], [7, 89, 864, "BMW"], [2, 13, 1026, "Bugatti"]];
196
 
197
    plot2 = $.jqplot('chart2',[arr],{
198
        title: 'Bubble Gradient Fills*',
199
        seriesDefaults:{
200
            renderer: $.jqplot.BubbleRenderer,
201
            rendererOptions: {
202
                bubbleGradients: true
203
            },
204
            shadow: true
205
        }
206
    });
207
 
208
});</script>
209
 
210
<script class="code" language="javascript" type="text/javascript">$(document).ready(function(){
211
 
212
    var arr = [[44, 66, 897, "Acura"], [25, 40, 1119, "Alfa Romeo"], [2, 33, 1197, "AM General"],
213
    [4, 132, 896, "Aston Martin Lagonda"], [2, 129, 314, "Audi"], [14, 47, 612, "BMW"],
214
    [45, 112, 719, "Bugatti"], [11, 38, 785, "Buick"], [15, 39, 367, "Cadillac"],
215
    [6, 133, 726, "Chevrolet"], [48, 84, 1082, "Citroen"], [40, 18, 1047, "DaimlerChrysler Corporation"],
216
    [24, 107, 1065, "Daewoo Motor Co."], [27, 92, 792, "Delorean Motor Company"], [1, 78, 803, "Dodge"],
217
    [5, 149, 320, "Ferrari"], [11, 127, 497, "Fiat"], [14, 18, 805, "Ford Motor Company"],
218
    [9, 101, 394, "General Motors"], [16, 57, 338, "GMC"], [19, 89, 977, "Holden"],
219
    [35, 78, 464, "Honda"], [18, 130, 364, "Hummer"], [37, 20, 699, "Hyundai"],
220
    [33, 140, 457, "Infiniti"], [12, 122, 533, "Isuzu"], [25, 67, 767, "Jaguar Cars"],
221
    [0, 7, 481, "Jeep"], [38, 36, 611, "Jensen Motors"], [43, 91, 943, "Kia"], [45, 21, 569, "Laforza"]];
222
 
223
    plot3 = $.jqplot('chart3',[arr],{
224
        title: 'Bubble Auto Scaling Options',
225
        seriesDefaults:{
226
            renderer: $.jqplot.BubbleRenderer,
227
            rendererOptions: {
228
                autoscalePointsFactor: -0.15,
229
                autoscaleMultiplier: 0.85,
230
                highlightMouseDown: true,
231
                bubbleAlpha: 0.7
232
            },
233
            shadow: true,
234
            shadowAlpha: 0.05
235
        }
236
    });
237
 
238
});</script>
239
 
240
 
241
<!-- End example scripts -->
242
 
243
<!-- Don't touch this! -->
244
 
245
 
246
    <script class="include" type="text/javascript" src="../jquery.jqplot.min.js"></script>
247
    <script type="text/javascript" src="syntaxhighlighter/scripts/shCore.min.js"></script>
248
    <script type="text/javascript" src="syntaxhighlighter/scripts/shBrushJScript.min.js"></script>
249
    <script type="text/javascript" src="syntaxhighlighter/scripts/shBrushXml.min.js"></script>
250
<!-- Additional plugins go here -->
251
 
252
  <script class="include" type="text/javascript" src="../plugins/jqplot.bubbleRenderer.min.js"></script>
253
 
254
<!-- End additional plugins -->
255
 
256
        </div>
257
         <div class="col2">
258
 
259
           <div class="example-link"><a class="example-link" href="data-renderers.html">AJAX and JSON Data Loading via Data Renderers</a></div>
260
           <div class="example-link"><a class="example-link" href="barLineAnimated.html">Animated Charts</a></div>
261
           <div class="example-link"><a class="example-link" href="dashboardWidget.html">Animated Dashboard Sample - Filled Line with Log Axis</a></div>
262
           <div class="example-link"><a class="example-link" href="kcp_area.html">Area Chart</a></div>
263
           <div class="example-link"><a class="example-link" href="kcp_area2.html">Area Chart 2</a></div>
264
           <div class="example-link"><a class="example-link" href="axisLabelTests.html">Axis Labels</a></div>
265
           <div class="example-link"><a class="example-link" href="axisLabelsRotatedText.html">Axis Labels and Rotated Text</a></div>
266
           <div class="example-link"><a class="example-link" href="barTest.html">Bar Charts</a></div>
267
           <div class="example-link"><a class="example-link" href="multipleBarColors.html">Bar Colors Example</a></div>
268
           <div class="example-link"><a class="example-link" href="bezierCurve.html">Bezier Curve Plots</a></div>
269
           <div class="example-link"><a class="example-link" href="blockPlot.html">Block Plots</a></div>
270
           <div class="example-link"><a class="example-link" href="bubbleChart.html">Bubble Charts</a></div>
271
           <div class="example-link"><a class="example-link" href="bubble-plots.html">Bubble Plots</a></div>
272
           <div class="example-link"><a class="example-link" href="candlestick.html">Candlestick and Open Hi Low Close Charts</a></div>
273
           <div class="example-link"><a class="example-link" href="theming.html">Chart Theming</a></div>
274
           <div class="example-link"><a class="example-link" href="fillBetweenLines.html">Charts with Fill Between Lines</a></div>
275
           <div class="example-link"><a class="example-link" href="kcp_cdf.html">Cumulative Density Function Chart</a></div>
276
           <div class="example-link"><a class="example-link" href="dashedLines.html">Dashed Lines with Smoothing</a></div>
277
           <div class="example-link"><a class="example-link" href="cursor-highlighter.html">Data Point Highlighting, Tooltips and Cursor Tracking</a></div>
278
           <div class="example-link"><a class="example-link" href="point-labels.html">Data Point labels</a></div>
279
           <div class="example-link"><a class="example-link" href="date-axes.html">Date Axes</a></div>
280
           <div class="example-link"><a class="example-link" href="dateAxisRenderer.html">Date Axes 2</a></div>
281
           <div class="example-link"><a class="example-link" href="rotatedTickLabelsZoom.html">Date Axes, Rotated Labels and Zooming</a></div>
282
           <div class="example-link"><a class="example-link" href="canvas-overlay.html">Draw Lines on Plots - Canvas Overlay</a></div>
283
           <div class="example-link"><a class="example-link" href="draw-rectangles.html">Draw Rectangles on Plots</a></div>
284
           <div class="example-link"><a class="example-link" href="kcp_engel.html">Engel Curves</a></div>
285
           <div class="example-link"><a class="example-link" href="bandedLine.html">Error Bands and Confidence Intervals</a></div>
286
           <div class="example-link"><a class="example-link" href="area.html">Filled (Area) Charts</a></div>
287
           <div class="example-link"><a class="example-link" href="axisScalingForceTickAt.html">Force Plot to Have Tick at 0 or 100</a></div>
288
           <div class="example-link"><a class="example-link" href="hiddenPlotsInTabs.html">Hidden Plots</a></div>
289
           <div class="example-link"><a class="example-link" href="customHighlighterCursorTrendline.html">Highlighting, Dragging Points, Cursor and Trend Lines</a></div>
290
           <div class="example-link"><a class="example-link" href="line-charts.html">Line Charts and Options</a></div>
291
           <div class="example-link"><a class="example-link" href="kcp_lorenz.html">Lorenz Curves</a></div>
292
           <div class="example-link"><a class="example-link" href="mekkoCharts.html">Mekko Charts</a></div>
293
           <div class="example-link"><a class="example-link" href="meterGauge.html">Meter Gauge</a></div>
294
           <div class="example-link"><a class="example-link" href="candlestick-charts.html">Open Hi Low Close and Candlestick Charts</a></div>
295
           <div class="example-link"><a class="example-link" href="pieTest.html">Pie Charts and Options</a></div>
296
           <div class="example-link"><a class="example-link" href="pieTest4.html">Pie Charts and Options 2</a></div>
297
           <div class="example-link"><a class="example-link" href="pie-donut-charts.html">Pie and Donut Charts</a></div>
298
           <div class="example-link"><a class="example-link" href="selectorSyntax.html">Plot Creation with jQuery Selectors</a></div>
299
           <div class="example-link"><a class="example-link" href="zooming.html">Plot Zooming and Cursor Control</a></div>
300
           <div class="example-link"><a class="example-link" href="kcp_pdf.html">Probability Density Function Chart</a></div>
301
           <div class="example-link"><a class="example-link" href="kcp_pyramid_by_age.html">Pyramid Chart By Age</a></div>
302
           <div class="example-link"><a class="example-link" href="kcp_pyramid.html">Pyramid Charts</a></div>
303
           <div class="example-link"><a class="example-link" href="kcp_pyramid2.html">Pyramid Charts 2</a></div>
304
           <div class="example-link"><a class="example-link" href="kcp_quintiles.html">Quintile Pyramid Charts</a></div>
305
           <div class="example-link"><a class="example-link" href="resizablePlot.html">Resizable Plots</a></div>
306
           <div class="example-link"><a class="example-link" href="rotated-tick-labels.html">Rotated Labels and Font Styling</a></div>
307
           <div class="example-link"><a class="example-link" href="smoothedLine.html">Smoothed Lines</a></div>
308
           <div class="example-link"><a class="example-link" href="bar-charts.html">Vertical and Horizontal Bar Charts</a></div>
309
           <div class="example-link"><a class="example-link" href="waterfall.html">Waterfall Charts</a></div>
310
           <div class="example-link"><a class="example-link" href="waterfall2.html">Waterfall Charts 2</a></div>
311
           <div class="example-link"><a class="example-link" href="zoomOptions.html">Zoom Options</a></div>
312
           <div class="example-link"><a class="example-link" href="zoomProxy.html">Zoom Proxy - Control one plot from another</a></div>
313
           <div class="example-link"><a class="example-link" href="zoom1.html">Zooming</a></div>
314
           <div class="example-link"><a class="example-link" href="dateAxisLogAxisZooming.html">Zooming with Date and Log Axes</a></div>
315
 
316
         </div>
317
               </div>
318
    </div>
319
    <script type="text/javascript" src="example.min.js"></script>
320
 
321
</body>
322
 
323
 
324
</html>