Subversion-Projekte lars-tiefland.ci

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
875 lars 1
<!DOCTYPE html>
2
 
3
<html>
4
<head>
5
 
6
    <title>Bubble Plots</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
 
37
    .note {
38
        font-size: 0.8em;
39
    }
40
 
41
    #tooltip1b {
42
        font-size: 12px;
43
        color: rgb(15%, 15%, 15%);
44
        padding:2px;
45
        background-color: rgba(95%, 95%, 95%, 0.8);
46
    }
47
 
48
    #legend1b {
49
        font-size: 12px;
50
        border: 1px solid #cdcdcd;
51
        border-collapse: collapse;
52
    }
53
    #legend1b td, #legend1b th {
54
        border: 1px solid #cdcdcd;
55
        padding: 1px 4px;
56
    }
57
 
58
 
59
  </style>
60
 
61
<p>Bubble charts represent 3 dimensional data.  First, a basic bubble chart with the "bubbleGradients: true" option to specify gradient fills.  Radial gradients are not supported in IE version before IE 9 and will be automatically disabled.</p>
62
 
63
<div id="chart1" style="height:340px; width:460px;"></div>
64
 
65
<pre class="code prettyprint brush: js"></pre>
66
 
67
 
68
<p>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>
69
 
70
<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>
71
 
72
<p>Next are some basic customizations of bubble appearance with the "bubbleAlpha" and "highlightAlpha" options.</p>
73
 
74
<div id="chart2" style="height:340px; width:460px;"></div>
75
 
76
<pre class="code prettyprint brush: js"></pre>
77
 
78
 
79
<p>In the following example, display of a custom toolip and highlighting of a custom table legend is performed by binding to the "jqplotDataHighlight" and "jqplotDataUnhighlight" events.  The custom legend table here is dynamically created with a few lines of jQuery (O.K., it could be done in one line) based on the data array of the plot.</p>
80
 
81
<div style="position:absolute;z-index:99;display:none;" id="tooltip1b"></div>
82
 
83
<table style="margin-left:auto; margin-right:auto;"><tr>
84
    <td><div id="chart1b" style="width:460px;height:340px;"></div></td>
85
    <td><div style="height:340px;"><table id="legend1b"><tr><th>Company</th><th>R Value</th></tr></table></div></td>
86
</tr></table>
87
 
88
<pre class="code prettyprint brush: js"></pre>
89
 
90
 
91
<script class="code" type="text/javascript">
92
$(document).ready(function(){
93
 
94
    var arr = [[11, 123, 1236, "Acura"], [45, 92, 1067, "Alfa Romeo"],
95
    [24, 104, 1176, "AM General"], [50, 23, 610, "Aston Martin Lagonda"],
96
    [18, 17, 539, "Audi"], [7, 89, 864, "BMW"], [2, 13, 1026, "Bugatti"]];
97
 
98
    var plot1 = $.jqplot('chart1',[arr],{
99
        title: 'Bubble Chart with Gradient Fills',
100
        seriesDefaults:{
101
            renderer: $.jqplot.BubbleRenderer,
102
            rendererOptions: {
103
                bubbleGradients: true
104
            },
105
            shadow: true
106
        }
107
    });
108
});
109
</script>
110
 
111
<script class="code" type="text/javascript">
112
$(document).ready(function(){
113
 
114
    var arr = [[11, 123, 1236, "Acura"], [45, 92, 1067, "Alfa Romeo"],
115
    [24, 104, 1176, "AM General"], [50, 23, 610, "Aston Martin Lagonda"],
116
    [18, 17, 539, "Audi"], [7, 89, 864, "BMW"], [2, 13, 1026, "Bugatti"]];
117
 
118
    var plot2 = $.jqplot('chart2',[arr],{
119
        title: 'Transparent Bubbles',
120
        seriesDefaults:{
121
            renderer: $.jqplot.BubbleRenderer,
122
            rendererOptions: {
123
                bubbleAlpha: 0.6,
124
                highlightAlpha: 0.8
125
            },
126
            shadow: true,
127
            shadowAlpha: 0.05
128
        }
129
    });
130
});
131
</script>
132
 
133
<script class="code" type="text/javascript">
134
$(document).ready(function(){
135
 
136
  var arr = [[11, 123, 1236, "Acura"], [45, 92, 1067, "Alfa Romeo"],
137
  [24, 104, 1176, "AM General"], [50, 23, 610, "Aston Martin Lagonda"],
138
  [18, 17, 539, "Audi"], [7, 89, 864, "BMW"], [2, 13, 1026, "Bugatti"]];
139
 
140
  var plot1b = $.jqplot('chart1b',[arr],{
141
    title: 'Tooltip and Custom Legend Highlighting',
142
    seriesDefaults:{
143
      renderer: $.jqplot.BubbleRenderer,
144
      rendererOptions: {
145
        bubbleAlpha: 0.6,
146
        highlightAlpha: 0.8,
147
        showLabels: false
148
      },
149
      shadow: true,
150
      shadowAlpha: 0.05
151
    }
152
  });
153
 
154
  // Legend is a simple table in the html.
155
  // Dynamically populate it with the labels from each data value.
156
  $.each(arr, function(index, val) {
157
    $('#legend1b').append('<tr><td>'+val[3]+'</td><td>'+val[2]+'</td></tr>');
158
  });
159
 
160
  // Now bind function to the highlight event to show the tooltip
161
  // and highlight the row in the legend.
162
  $('#chart1b').bind('jqplotDataHighlight',
163
    function (ev, seriesIndex, pointIndex, data, radius) {
164
      var chart_left = $('#chart1b').offset().left,
165
        chart_top = $('#chart1b').offset().top,
166
        x = plot1b.axes.xaxis.u2p(data[0]),  // convert x axis unita to pixels
167
        y = plot1b.axes.yaxis.u2p(data[1]);  // convert y axis units to pixels
168
      var color = 'rgb(50%,50%,100%)';
169
      $('#tooltip1b').css({left:chart_left+x+radius+5, top:chart_top+y});
170
      $('#tooltip1b').html('<span style="font-size:14px;font-weight:bold;color:' +
171
      color + ';">' + data[3] + '</span><br />' + 'x: ' + data[0] +
172
      '<br />' + 'y: ' + data[1] + '<br />' + 'r: ' + data[2]);
173
      $('#tooltip1b').show();
174
      $('#legend1b tr').css('background-color', '#ffffff');
175
      $('#legend1b tr').eq(pointIndex+1).css('background-color', color);
176
    });
177
 
178
  // Bind a function to the unhighlight event to clean up after highlighting.
179
  $('#chart1b').bind('jqplotDataUnhighlight',
180
      function (ev, seriesIndex, pointIndex, data) {
181
          $('#tooltip1b').empty();
182
          $('#tooltip1b').hide();
183
          $('#legend1b tr').css('background-color', '#ffffff');
184
      });
185
});
186
</script>
187
 
188
<!-- End example scripts -->
189
 
190
<!-- Don't touch this! -->
191
 
192
 
193
    <script class="include" type="text/javascript" src="../jquery.jqplot.min.js"></script>
194
    <script type="text/javascript" src="syntaxhighlighter/scripts/shCore.min.js"></script>
195
    <script type="text/javascript" src="syntaxhighlighter/scripts/shBrushJScript.min.js"></script>
196
    <script type="text/javascript" src="syntaxhighlighter/scripts/shBrushXml.min.js"></script>
197
<!-- End Don't touch this! -->
198
 
199
<!-- Additional plugins go here -->
200
 
201
    <script class="include" language="javascript" type="text/javascript" src="../plugins/jqplot.bubbleRenderer.min.js"></script>
202
 
203
<!-- End additional plugins -->
204
 
205
        </div>
206
         <div class="col2">
207
 
208
           <div class="example-link"><a class="example-link" href="data-renderers.html">AJAX and JSON Data Loading via Data Renderers</a></div>
209
           <div class="example-link"><a class="example-link" href="barLineAnimated.html">Animated Charts</a></div>
210
           <div class="example-link"><a class="example-link" href="dashboardWidget.html">Animated Dashboard Sample - Filled Line with Log Axis</a></div>
211
           <div class="example-link"><a class="example-link" href="kcp_area.html">Area Chart</a></div>
212
           <div class="example-link"><a class="example-link" href="kcp_area2.html">Area Chart 2</a></div>
213
           <div class="example-link"><a class="example-link" href="axisLabelTests.html">Axis Labels</a></div>
214
           <div class="example-link"><a class="example-link" href="axisLabelsRotatedText.html">Axis Labels and Rotated Text</a></div>
215
           <div class="example-link"><a class="example-link" href="barTest.html">Bar Charts</a></div>
216
           <div class="example-link"><a class="example-link" href="multipleBarColors.html">Bar Colors Example</a></div>
217
           <div class="example-link"><a class="example-link" href="bezierCurve.html">Bezier Curve Plots</a></div>
218
           <div class="example-link"><a class="example-link" href="blockPlot.html">Block Plots</a></div>
219
           <div class="example-link"><a class="example-link" href="bubbleChart.html">Bubble Charts</a></div>
220
           <div class="example-link"><a class="example-link" href="bubble-plots.html">Bubble Plots</a></div>
221
           <div class="example-link"><a class="example-link" href="candlestick.html">Candlestick and Open Hi Low Close Charts</a></div>
222
           <div class="example-link"><a class="example-link" href="theming.html">Chart Theming</a></div>
223
           <div class="example-link"><a class="example-link" href="fillBetweenLines.html">Charts with Fill Between Lines</a></div>
224
           <div class="example-link"><a class="example-link" href="kcp_cdf.html">Cumulative Density Function Chart</a></div>
225
           <div class="example-link"><a class="example-link" href="dashedLines.html">Dashed Lines with Smoothing</a></div>
226
           <div class="example-link"><a class="example-link" href="cursor-highlighter.html">Data Point Highlighting, Tooltips and Cursor Tracking</a></div>
227
           <div class="example-link"><a class="example-link" href="point-labels.html">Data Point labels</a></div>
228
           <div class="example-link"><a class="example-link" href="date-axes.html">Date Axes</a></div>
229
           <div class="example-link"><a class="example-link" href="dateAxisRenderer.html">Date Axes 2</a></div>
230
           <div class="example-link"><a class="example-link" href="rotatedTickLabelsZoom.html">Date Axes, Rotated Labels and Zooming</a></div>
231
           <div class="example-link"><a class="example-link" href="canvas-overlay.html">Draw Lines on Plots - Canvas Overlay</a></div>
232
           <div class="example-link"><a class="example-link" href="draw-rectangles.html">Draw Rectangles on Plots</a></div>
233
           <div class="example-link"><a class="example-link" href="kcp_engel.html">Engel Curves</a></div>
234
           <div class="example-link"><a class="example-link" href="bandedLine.html">Error Bands and Confidence Intervals</a></div>
235
           <div class="example-link"><a class="example-link" href="area.html">Filled (Area) Charts</a></div>
236
           <div class="example-link"><a class="example-link" href="axisScalingForceTickAt.html">Force Plot to Have Tick at 0 or 100</a></div>
237
           <div class="example-link"><a class="example-link" href="hiddenPlotsInTabs.html">Hidden Plots</a></div>
238
           <div class="example-link"><a class="example-link" href="customHighlighterCursorTrendline.html">Highlighting, Dragging Points, Cursor and Trend Lines</a></div>
239
           <div class="example-link"><a class="example-link" href="line-charts.html">Line Charts and Options</a></div>
240
           <div class="example-link"><a class="example-link" href="kcp_lorenz.html">Lorenz Curves</a></div>
241
           <div class="example-link"><a class="example-link" href="mekkoCharts.html">Mekko Charts</a></div>
242
           <div class="example-link"><a class="example-link" href="meterGauge.html">Meter Gauge</a></div>
243
           <div class="example-link"><a class="example-link" href="candlestick-charts.html">Open Hi Low Close and Candlestick Charts</a></div>
244
           <div class="example-link"><a class="example-link" href="pieTest.html">Pie Charts and Options</a></div>
245
           <div class="example-link"><a class="example-link" href="pieTest4.html">Pie Charts and Options 2</a></div>
246
           <div class="example-link"><a class="example-link" href="pie-donut-charts.html">Pie and Donut Charts</a></div>
247
           <div class="example-link"><a class="example-link" href="selectorSyntax.html">Plot Creation with jQuery Selectors</a></div>
248
           <div class="example-link"><a class="example-link" href="zooming.html">Plot Zooming and Cursor Control</a></div>
249
           <div class="example-link"><a class="example-link" href="kcp_pdf.html">Probability Density Function Chart</a></div>
250
           <div class="example-link"><a class="example-link" href="kcp_pyramid_by_age.html">Pyramid Chart By Age</a></div>
251
           <div class="example-link"><a class="example-link" href="kcp_pyramid.html">Pyramid Charts</a></div>
252
           <div class="example-link"><a class="example-link" href="kcp_pyramid2.html">Pyramid Charts 2</a></div>
253
           <div class="example-link"><a class="example-link" href="kcp_quintiles.html">Quintile Pyramid Charts</a></div>
254
           <div class="example-link"><a class="example-link" href="resizablePlot.html">Resizable Plots</a></div>
255
           <div class="example-link"><a class="example-link" href="rotated-tick-labels.html">Rotated Labels and Font Styling</a></div>
256
           <div class="example-link"><a class="example-link" href="smoothedLine.html">Smoothed Lines</a></div>
257
           <div class="example-link"><a class="example-link" href="bar-charts.html">Vertical and Horizontal Bar Charts</a></div>
258
           <div class="example-link"><a class="example-link" href="waterfall.html">Waterfall Charts</a></div>
259
           <div class="example-link"><a class="example-link" href="waterfall2.html">Waterfall Charts 2</a></div>
260
           <div class="example-link"><a class="example-link" href="zoomOptions.html">Zoom Options</a></div>
261
           <div class="example-link"><a class="example-link" href="zoomProxy.html">Zoom Proxy - Control one plot from another</a></div>
262
           <div class="example-link"><a class="example-link" href="zoom1.html">Zooming</a></div>
263
           <div class="example-link"><a class="example-link" href="dateAxisLogAxisZooming.html">Zooming with Date and Log Axes</a></div>
264
 
265
         </div>
266
               </div>
267
    </div>
268
    <script type="text/javascript" src="example.min.js"></script>
269
 
270
</body>
271
 
272
 
273
</html>