| Current Path : /home/emeraadmin/www/4d695/ |
| Current File : /home/emeraadmin/www/4d695/examples.tar |
assets/citynames.json 0000644 00000000340 15167726216 0010747 0 ustar 00 [ "Amsterdam",
"London",
"Paris",
"Washington",
"New York",
"Los Angeles",
"Sydney",
"Melbourne",
"Canberra",
"Beijing",
"New Delhi",
"Kathmandu",
"Cairo",
"Cape Town",
"Kinshasa"
] assets/app_bs3.js 0000644 00000005477 15167726216 0007765 0 ustar 00 var citynames = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('name'),
queryTokenizer: Bloodhound.tokenizers.whitespace,
prefetch: {
url: 'assets/citynames.json',
filter: function(list) {
return $.map(list, function(cityname) {
return { name: cityname }; });
}
}
});
citynames.initialize();
var cities = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('text'),
queryTokenizer: Bloodhound.tokenizers.whitespace,
prefetch: 'assets/cities.json'
});
cities.initialize();
/**
* Typeahead
*/
var elt = $('.example_typeahead > > input');
elt.tagsinput({
typeaheadjs: {
name: 'citynames',
displayKey: 'name',
valueKey: 'name',
source: citynames.ttAdapter()
}
});
/**
* Objects as tags
*/
elt = $('.example_objects_as_tags > > input');
elt.tagsinput({
itemValue: 'value',
itemText: 'text',
typeaheadjs: {
name: 'cities',
displayKey: 'text',
source: cities.ttAdapter()
}
});
elt.tagsinput('add', { "value": 1 , "text": "Amsterdam" , "continent": "Europe" });
elt.tagsinput('add', { "value": 4 , "text": "Washington" , "continent": "America" });
elt.tagsinput('add', { "value": 7 , "text": "Sydney" , "continent": "Australia" });
elt.tagsinput('add', { "value": 10, "text": "Beijing" , "continent": "Asia" });
elt.tagsinput('add', { "value": 13, "text": "Cairo" , "continent": "Africa" });
/**
* Categorizing tags
*/
elt = $('.example_tagclass > > input');
elt.tagsinput({
tagClass: function(item) {
switch (item.continent) {
case 'Europe' : return 'label label-primary';
case 'America' : return 'label label-danger label-important';
case 'Australia': return 'label label-success';
case 'Africa' : return 'label label-default';
case 'Asia' : return 'label label-warning';
}
},
itemValue: 'value',
itemText: 'text',
// typeaheadjs: {
// name: 'cities',
// displayKey: 'text',
// source: cities.ttAdapter()
// }
typeaheadjs: [
{
hint: true,
highlight: true,
minLength: 2
},
{
name: 'cities',
displayKey: 'text',
source: cities.ttAdapter()
}
]
});
elt.tagsinput('add', { "value": 1 , "text": "Amsterdam" , "continent": "Europe" });
elt.tagsinput('add', { "value": 4 , "text": "Washington" , "continent": "America" });
elt.tagsinput('add', { "value": 7 , "text": "Sydney" , "continent": "Australia" });
elt.tagsinput('add', { "value": 10, "text": "Beijing" , "continent": "Asia" });
elt.tagsinput('add', { "value": 13, "text": "Cairo" , "continent": "Africa" });
// HACK: overrule hardcoded display inline-block of typeahead.js
$(".twitter-typeahead").css('display', 'inline');
assets/app.css 0000644 00000002363 15167726216 0007361 0 ustar 00 .icon-github {
background: no-repeat url('../img/github-16px.png');
width: 16px;
height: 16px;
}
.bootstrap-tagsinput {
width: 100%;
}
.accordion {
margin-bottom:-3px;
}
.accordion-group {
border: none;
}
.twitter-typeahead .tt-query,
.twitter-typeahead .tt-hint {
margin-bottom: 0;
}
.twitter-typeahead .tt-hint
{
display: none;
}
.tt-menu {
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
display: none;
float: left;
min-width: 160px;
padding: 5px 0;
margin: 2px 0 0;
list-style: none;
font-size: 14px;
background-color: #ffffff;
border: 1px solid #cccccc;
border: 1px solid rgba(0, 0, 0, 0.15);
border-radius: 4px;
-webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
background-clip: padding-box;
cursor: pointer;
}
.tt-suggestion {
display: block;
padding: 3px 20px;
clear: both;
font-weight: normal;
line-height: 1.428571429;
color: #333333;
white-space: nowrap;
}
.tt-suggestion:hover,
.tt-suggestion:focus {
color: #ffffff;
text-decoration: none;
outline: 0;
background-color: #428bca;
}
assets/app.js 0000644 00000001033 15167726216 0007176 0 ustar 00 $(function() {
$('input, select').on('change', function(event) {
var $element = $(event.target),
$container = $element.closest('.example');
if (!$element.data('tagsinput'))
return;
var val = $element.val();
if (val === null)
val = "null";
$('code', $('pre.val', $container)).html( ($.isArray(val) ? JSON.stringify(val) : "\"" + val.replace('"', '\\"') + "\"") );
$('code', $('pre.items', $container)).html(JSON.stringify($element.tagsinput('items')));
}).trigger('change');
}); assets/cities.json 0000644 00000002032 15167726216 0010233 0 ustar 00 [ { "value": 1 , "text": "Amsterdam" , "continent": "Europe" },
{ "value": 2 , "text": "London" , "continent": "Europe" },
{ "value": 3 , "text": "Paris" , "continent": "Europe" },
{ "value": 4 , "text": "Washington" , "continent": "America" },
{ "value": 5 , "text": "Mexico City" , "continent": "America" },
{ "value": 6 , "text": "Buenos Aires", "continent": "America" },
{ "value": 7 , "text": "Sydney" , "continent": "Australia" },
{ "value": 8 , "text": "Wellington" , "continent": "Australia" },
{ "value": 9 , "text": "Canberra" , "continent": "Australia" },
{ "value": 10, "text": "Beijing" , "continent": "Asia" },
{ "value": 11, "text": "New Delhi" , "continent": "Asia" },
{ "value": 12, "text": "Kathmandu" , "continent": "Asia" },
{ "value": 13, "text": "Cairo" , "continent": "Africa" },
{ "value": 14, "text": "Cape Town" , "continent": "Africa" },
{ "value": 15, "text": "Kinshasa" , "continent": "Africa" }
] assets/app_bs2.js 0000644 00000006300 15167726216 0007746 0 ustar 00 $('.example_typeahead > > input').tagsinput({
typeahead: {
source: function(query) {
return $.getJSON('assets/citynames.json');
}
}
});
$('.example_objects_as_tags > > input').tagsinput({
itemValue: 'value',
itemText: 'text',
typeahead: {
source: function(query) {
return $.getJSON('assets/cities.json');
}
}
});
$('.example_objects_as_tags > > input').tagsinput('add', { "value": 1 , "text": "Amsterdam" , "continent": "Europe" });
$('.example_objects_as_tags > > input').tagsinput('add', { "value": 4 , "text": "Washington" , "continent": "America" });
$('.example_objects_as_tags > > input').tagsinput('add', { "value": 7 , "text": "Sydney" , "continent": "Australia" });
$('.example_objects_as_tags > > input').tagsinput('add', { "value": 10, "text": "Beijing" , "continent": "Asia" });
$('.example_objects_as_tags > > input').tagsinput('add', { "value": 13, "text": "Cairo" , "continent": "Africa" });
$('.example_tagclass > > input').tagsinput({
tagClass: function(item) {
switch (item.continent) {
case 'Europe' : return 'label label-info';
case 'America' : return 'label label-danger label-important';
case 'Australia': return 'label label-success';
case 'Africa' : return 'label';
case 'Asia' : return 'label label-warning';
}
},
itemValue: 'value',
itemText: 'text',
typeahead: {
source: function(query) {
return $.getJSON('assets/cities.json');
}
}
});
$('.example_tagclass > > input').tagsinput('add', { "value": 1 , "text": "Amsterdam" , "continent": "Europe" });
$('.example_tagclass > > input').tagsinput('add', { "value": 4 , "text": "Washington" , "continent": "America" });
$('.example_tagclass > > input').tagsinput('add', { "value": 7 , "text": "Sydney" , "continent": "Australia" });
$('.example_tagclass > > input').tagsinput('add', { "value": 10, "text": "Beijing" , "continent": "Asia" });
$('.example_tagclass > > input').tagsinput('add', { "value": 13, "text": "Cairo" , "continent": "Africa" });
angular.module('AngularExample', ['bootstrap-tagsinput'])
.controller('CityTagsInputController',
function CityTagsInputController($scope, $http) {
// Init with some cities
$scope.cities = [
{ "value": 1 , "text": "Amsterdam" , "continent": "Europe" },
{ "value": 4 , "text": "Washington" , "continent": "America" },
{ "value": 7 , "text": "Sydney" , "continent": "Australia" },
{ "value": 10, "text": "Beijing" , "continent": "Asia" },
{ "value": 13, "text": "Cairo" , "continent": "Africa" }
];
$scope.queryCities = function(query) {
return $http.get('assets/cities.json');
};
$scope.getTagClass = function(city) {
switch (city.continent) {
case 'Europe' : return 'label label-info';
case 'America' : return 'label label-danger label-important';
case 'Australia': return 'label label-success';
case 'Africa' : return 'label';
case 'Asia' : return 'label label-warning';
}
};
}
); bootstrap-2.3.2.html 0000644 00000072062 15167726216 0010133 0 ustar 00 <!DOCTYPE html>
<html>
<head>
<title>Bootstrap Tags Input</title>
<meta name="robots" content="index, follow" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.3.2/css/bootstrap.min.css">
<link rel="stylesheet" href="../dist/bootstrap-tagsinput.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/rainbow/1.2.0/themes/github.css">
<link rel="stylesheet" href="http://getbootstrap.com/2.3.2/assets/css/docs.css">
<link rel="stylesheet" href="assets/app.css">
<style>
.accordion { margin-top:-19px; }
</style>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-42755476-1', 'timschlechter.github.io');
ga('send', 'pageview');
</script>
</head>
<body>
<div id="fb-root"></div>
<div class="navbar navbar-inverse navbar-fixed-top bs-docs-nav">
<div class="navbar-inner">
<div class="container">
<div class="nav-collapse collapse bs-navbar-collapse">
<ul class="nav navbar-nav">
<li>
<a href="https://github.com/timschlechter/bootstrap-tagsinput">Code on Github</a>
</li>
<li>
<a href=".">Bootstrap 3</a>
</li>
<li>
<a href="http://timschlechter.github.io/bootstrap-tagsinput/dist/bootstrap-tagsinput.zip">Download <small>(latest)</small></a>
</li>
</ul>
<p class="navbar-text pull-right">
<a href="https://twitter.com/share" class="navbar-link twitter-share-button"
data-hashtags="bootstraptagsinput">Tweet</a>
<script>!function (d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (!d.getElementById(id)) {
js = d.createElement(s);
js.id = id;
js.src = "//platform.twitter.com/widgets.js";
fjs.parentNode.insertBefore(js, fjs);
}
}(document, "script", "twitter-wjs");</script>
<!-- Place this tag where you want the +1 button to render. -->
<a class="navbar-link g-plusone" data-size="medium"></a>
<!-- Place this tag after the last +1 button tag. -->
<script type="text/javascript">
(function () {
var po = document.createElement('script');
po.type = 'text/javascript';
po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(po, s);
})();
</script>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=122064240555";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<a class="navbar-link fb-like" data-href="http://timschlechter.github.io/bootstrap-tagsinput/examples/" data-width="110" data-layout="button_count" data-show-faces="true" data-send="false"></a>
</p>
</div>
</div>
</div>
</div>
<header class="jumbotron subhead">
<div class="container">
<h1>Bootstrap Tags Input</h1>
<p>jQuery plugin providing a Twitter Bootstrap user interface for managing tags</p>
</header>
<div class="container">
<section id="examples">
<div class="page-header">
<h2>Examples</h2>
</div>
<div class="example example_markup">
<h3>Markup</h3>
<p>
Just add <code>data-role="tagsinput"</code> to your input field to automatically change it to a tags input field.
</p>
<div class="bs-docs-example">
<input type="text" value="Amsterdam,Washington,Sydney,Beijing,Cairo" data-role="tagsinput" placeholder="Add tags" />
</div>
<div class="accordion">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" href="#accordion_example_markup">
Show code
</a>
</div>
<div id="accordion_example_markup" class="accordion-body collapse">
<div class="accordion-inner">
<pre><code data-language="html"><input type="text" value="Amsterdam,Washington,Sydney,Beijing,Cairo" data-role="tagsinput" placeholder="Add tags" /></code></pre>
</div>
</div>
</div>
</div>
<table class="table table-bordered table-condensed"><thead><tr><th>statement</th><th>returns</th></tr></thead><tbody><tr><td><code>$("input").val()</code></td><td><pre class="val"><code data-language="javascript"></code></pre></td></tr><tr><td><code>$("input").tagsinput('items')</code></td><td><pre class="items"><code data-language="javascript"></code></pre></td></tr></tbody></table>
</div>
<div class="example example_multivalue">
<h3>True multi value</h3>
<p>
Use a <code><select multiple /></code> as your input element for a tags input, to gain true multivalue support. Instead of a comma separated string, the values will be set in an array. Existing <code><option /></code> elements will automatically be set as tags. This makes it also possible to create tags containing a comma.
</p>
<div class="bs-docs-example">
<select multiple data-role="tagsinput">
<option value="Amsterdam">Amsterdam</option>
<option value="Washington">Washington</option>
<option value="Sydney">Sydney</option>
<option value="Beijing">Beijing</option>
<option value="Cairo">Cairo</option>
</select>
</div>
<div class="accordion ">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" href="#example_multivalue">
Show code
</a>
</div>
<div id="example_multivalue" class="accordion-body collapse">
<div class="accordion-inner">
<pre><code data-language="html"><select multiple data-role="tagsinput">
<option value="Amsterdam">Amsterdam</option>
<option value="Washington">Washington</option>
<option value="Sydney">Sydney</option>
<option value="Beijing">Beijing</option>
<option value="Cairo">Cairo</option>
</select></code></pre>
</div>
</div>
</div>
</div>
<table class="table table-bordered table-condensed"><thead><tr><th>statement</th><th>returns</th></tr></thead><tbody><tr><td><code>$("select").val()</code></td><td><pre class="val"><code data-language="javascript"></code></pre></td></tr><tr><td><code>$("select").tagsinput('items')</code></td><td><pre class="items"><code data-language="javascript"></code></pre></td></tr></tbody></table>
</div>
<div class="example example_typeahead">
<h3>Typeahead</h3>
<div class="bs-docs-example">
<input type="text" value="Amsterdam,Washington" />
</div>
<div class="accordion ">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse"href="#example_typeahead">
Show code
</a>
</div>
<div id="example_typeahead" class="accordion-body collapse">
<div class="accordion-inner">
<pre><code data-language="html"><input type="text" value="Amsterdam,Washington" data-role="tagsinput" />
<script>
$('input').tagsinput({
typeahead: {
source: function(query) {
return $.getJSON('citynames.json');
}
}
});
</script></code></pre>
</div>
</div>
</div>
</div>
<table class="table table-bordered table-condensed"><thead><tr><th>statement</th><th>returns</th></tr></thead><tbody><tr><td><code>$("input").val()</code></td><td><pre class="val"><code data-language="javascript"></code></pre></td></tr><tr><td><code>$("input").tagsinput('items')</code></td><td><pre class="items"><code data-language="javascript"></code></pre></td></tr></tbody></table>
</div>
<div class="example example_objects_as_tags">
<h3>Objects as tags</h3>
<p>
Instead of just adding strings as tags, bind objects to your tags. This makes it possible to set id values in your input field's value, instead of just the tag's text.
</p>
<div class="bs-docs-example">
<input type="text" />
</div>
<div class="accordion">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" href="#accordion_example_objects_as_tags">
Show code
</a>
</div>
<div id="accordion_example_objects_as_tags" class="accordion-body collapse">
<div class="accordion-inner">
<pre><code data-language="html"><input type="text" />
<script>
$('input').tagsinput({
itemValue: 'value',
itemText: 'text',
typeahead: {
source: function(query) {
return $.getJSON('cities.json');
}
}
});
$('input').tagsinput('add', { "value": 1 , "text": "Amsterdam" });
$('input').tagsinput('add', { "value": 4 , "text": "Washington" });
$('input').tagsinput('add', { "value": 7 , "text": "Sydney" });
$('input').tagsinput('add', { "value": 10, "text": "Beijing" });
$('input').tagsinput('add', { "value": 13, "text": "Cairo" });
</script></code></pre>
</div>
</div>
</div>
</div>
<table class="table table-bordered table-condensed"><thead><tr><th>statement</th><th>returns</th></tr></thead><tbody><tr><td><code>$("input").val()</code></td><td><pre class="val"><code data-language="javascript"></code></pre></td></tr><tr><td><code>$("input").tagsinput('items')</code></td><td><pre class="items"><code data-language="javascript"></code></pre></td></tr></tbody></table>
</div>
<div class="example example_tagclass">
<h3>Categorizing tags</h3>
<p>
You can set a fixed css class for your tags, or determine dynamically by providing a custom function.
</p>
<div class="bs-docs-example">
<input type="text" />
</div>
<div class="accordion">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" href="#accordion_example_tagclass">
Show code
</a>
</div>
<div id="accordion_example_tagclass" class="accordion-body collapse">
<div class="accordion-inner">
<pre><code data-language="html"><input type="text" />
<script>
$('input').tagsinput({
tagClass: function(item) {
switch (item.continent) {
case 'Europe' : return 'label label-info';
case 'America' : return 'label label-important';
case 'Australia': return 'label label-success';
case 'Africa' : return 'badge badge-inverse';
case 'Asia' : return 'badge badge-warning';
}
},
itemValue: 'value',
itemText: 'text',
typeahead: {
source: function(query) {
return $.getJSON('cities.json');
}
}
});
$('input').tagsinput('add', { "value": 1 , "text": "Amsterdam" , "continent": "Europe" });
$('input').tagsinput('add', { "value": 4 , "text": "Washington" , "continent": "America" });
$('input').tagsinput('add', { "value": 7 , "text": "Sydney" , "continent": "Australia" });
$('input').tagsinput('add', { "value": 10, "text": "Beijing" , "continent": "Asia" });
$('input').tagsinput('add', { "value": 13, "text": "Cairo" , "continent": "Africa" });
</script></code></pre>
</div>
</div>
</div>
</div>
<table class="table table-bordered table-condensed"><thead><tr><th>statement</th><th>returns</th></tr></thead><tbody><tr><td><code>$("input").val()</code></td><td><pre class="val"><code data-language="javascript"></code></pre></td></tr><tr><td><code>$("input").tagsinput('items')</code></td><td><pre class="items"><code data-language="javascript"></code></pre></td></tr></tbody></table>
</div>
<div id="angular" class="example example_angular" ng-app="AngularExample" ng-controller="CityTagsInputController">
<h3>AngularJS support</h3>
<p>
Include <code>bootstrap-tagsinput-angular.js</code> and register the 'bootstrap-tagsinput' in your Angular JS application to use the bootstrap-tagsinput directive.
</p>
<div class="bs-docs-example">
<bootstrap-tagsinput
ng-model="cities"
typeahead-source="queryCities"
tagclass="getTagClass"
itemvalue="value"
itemtext="text">
</bootstrap-tagsinput>
</div>
<div class="accordion">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" href="#example_angular">
Show code
</a>
</div>
<div id="example_angular" class="accordion-body collapse">
<div class="accordion-inner">
<pre><code data-language="html"><bootstrap-tagsinput
ng-model="cities"
typeahead-source="queryCities"
tagclass="getTagClass"
itemvalue="value"
itemtext="text">
</bootstrap-tagsinput>
<script>
angular.module('AngularExample', ['bootstrap-tagsinput'])
.controller('CityTagsInputController',
function CityTagsInputController($scope) {
// Init with some cities
$scope.cities = [
{ "value": 1 , "text": "Amsterdam" , "continent": "Europe" },
{ "value": 4 , "text": "Washington" , "continent": "America" },
{ "value": 7 , "text": "Sydney" , "continent": "Australia" },
{ "value": 10, "text": "Beijing" , "continent": "Asia" },
{ "value": 13, "text": "Cairo" , "continent": "Africa" }
];
$scope.queryCities = function(query) {
return $http.get('cities.json');
};
$scope.getTagClass = function(city) {
switch (city.continent) {
case 'Europe' : return 'badge badge-info';
case 'America' : return 'label label-important';
case 'Australia': return 'badge badge-success';
case 'Africa' : return 'label label-inverse';
case 'Asia' : return 'badge badge-warning';
}
};
}
);
</script></code></pre>
</div>
</div>
</div>
</div>
<table class="table table-bordered table-condensed">
<thead>
<tr><th>statement</th><th>returns</th></tr>
</thead>
<tbody>
<tr><td><code>$scope.cities</code></td><td><pre><code data-language="javascript">{{cities}}</code></pre></td></tr>
<tr><td><code>$("select").val()</code></td><td><pre class="val"><code data-language="javascript"></code></pre></td></tr>
<tr><td><code>$("select").tagsinput('items')</code></td><td><pre class="items"><code data-language="javascript"></code></pre></td></tr>
</tbody>
</table>
</div>
</section>
<section id="options">
<div class="page-header">
<h2>Options</h2>
</div>
<table class="table table-bordered table-condensed">
<thead>
<tr>
<th colspan="2">option</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="2"><code>tagClass</code></td>
<td>
<p>Classname for the tags, or a function returning a classname</p>
<pre><code data-language="javascript">$('input').tagsinput({
tagClass: 'big'
});</code></pre>
<pre><code data-language="javascript">$('input').tagsinput({
tagClass: function(item) {
return (item.length > 10 ? 'big' : 'small');
}
});</code></pre>
</td>
</tr>
<tr>
<td colspan="2"><code>itemValue</code></td>
<td>
<p>When adding objects as tags, itemValue <em>must</em> be set to the name of the property containing the item's value, or a function returning an item's value.</p>
<pre><code data-language="javascript">$('input').tagsinput({
itemValue: 'id'
});</code></pre>
<pre><code data-language="javascript">$('input').tagsinput({
itemValue: function(item) {
return item.id;
}
});</code></pre>
</td>
</tr>
<tr>
<td colspan="2"><code>itemText</code></td>
<td>
<p>When adding objects as tags, you can set itemText to the name of the property of item to use for a its tag's text. You may also provide a function which returns an item's value. When this options is not set, the value of <code>itemValue</code> will be used.
<pre><code data-language="javascript">$('input').tagsinput({
itemText: 'label'
});</code></pre>
<pre><code data-language="javascript">$('input').tagsinput({
itemText: function(item) {
return item.label;
}
});</code></pre>
</td>
</tr>
<tr>
<td colspan="2"><code>confirmKeys</code></td>
<td>
<p>Array of keycodes which will add a tag when typing in the input. (default: [13, 188], which are ENTER and comma)</p>
<pre><code data-language="javascript">$('input').tagsinput({
confirmKeys: [13, 44]
});</code></pre>
</td>
</tr>
<tr>
<td colspan="2"><code>maxTags</code></td>
<td>
<p>When set, no more than the given number of tags are allowed to add (default: undefined). When maxTags is reached, a class 'bootstrap-tagsinput-max' is placed on the tagsinput element. (default: undefined)</p>
<pre><code data-language="javascript">$('input').tagsinput({
maxTags: 3
});</code></pre>
</td>
</tr>
<tr>
<td colspan="2"><code>maxChars</code></td>
<td>
<p>Defines the maximum length of a single tag. (default: undefined)</p>
<pre><code data-language="javascript">$('input').tagsinput({
maxChars: 8
});</code></pre>
</td>
</tr>
<tr>
<td colspan="2"><code>trimValue</code></td>
<td>
<p>When true, automatically removes all whitespace around tags. (default: false)</p>
<pre><code data-language="javascript">$('input').tagsinput({
trimValue: true
});</code></pre>
</td>
</tr>
<tr>
<td colspan="2"><code>allowDuplicates</code></td>
<td>
<p>When true, the same tag can be added multiple times. (default: false)</p>
<pre><code data-language="javascript">$('input').tagsinput({
allowDuplicates: true
});</code></pre>
</td>
</tr>
<tr>
<td colspan="2"><code>maxChars</code></td>
<td>
<p>Defines the maximum length of a single tag.</p>
<pre><code data-language="javascript">$('input').tagsinput({
maxChars: 8
});</code></pre>
</td>
</tr>
<tr>
<td colspan="2"><code>freeInput</code></td>
<td>
<p>Allow creating tags which are not returned by typeahead's source (default: true)</p>
<div class="alert alert-block">
This is only possible when using string as tags. When itemValue option is set, this option will be ignored.
</div>
<pre><code data-language="javascript">$('input').tagsinput({
typeahead: {
source: ['Amsterdam', 'Washington', 'Sydney', 'Beijing', 'Cairo'],
freeInput: true
}
});</code></pre>
</td>
</tr>
<tr>
<td colspan="2"><code>typeahead</code></td>
<td><p>Object containing typeahead specific options</td>
</tr>
</tr>
<tr>
<td></td>
<td><code>source</code></td>
<td>
<p>An array (or function returning a promise or array), which will be used as source for a typeahead.
<pre><code data-language="javascript">$('input').tagsinput({
typeahead: {
source: ['Amsterdam', 'Washington', 'Sydney', 'Beijing', 'Cairo']
}
});</code></pre>
<pre><code data-language="javascript">$('input').tagsinput({
typeahead: {
source: function(query) {
return $.get('http://someservice.com');
}
}
});</code></pre>
</td>
</tr>
<tr>
<td colspan="2"><code>onTagExists</code></td>
<td><p>Function invoked when trying to add an item which allready exists. By default, the existing tag hides and fades in.
<pre><code data-language="javascript">$('input').tagsinput({
onTagExists: function(item, $tag) {
$tag.hide.fadeIn();
}
});</code></pre>
</td>
</tr>
</tbody>
</table>
</section>
<section id="methods">
<div class="page-header">
<h2>Methods</h2>
</div>
<table class="table table-bordered table-condensed">
<thead>
<tr>
<th>method</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>add</code></td>
<td>
<p>Adds a tag</p>
<pre><code data-language="javascript">$('input').tagsinput('add', 'some tag');</code></pre>
<pre><code data-language="javascript">$('input').tagsinput('add', { id: 1, text: 'some tag' });</code></pre>
</td>
</tr>
<tr>
<td><code>remove</code></td>
<td>
<p>Removes a tag</p>
<pre><code data-language="javascript">$('input').tagsinput('remove', 'some tag');</code></pre>
<pre><code data-language="javascript">$('input').tagsinput('remove', { id: 1, text: 'some tag' });</code></pre>
</td>
</tr>
<tr>
<td><code>removeAll</code></td>
<td>
<p>Removes all tags</p>
<pre><code data-language="javascript">$('input').tagsinput('removeAll');</code></pre>
</td>
</tr>
<tr>
<td><code>focus</code></td>
<td>
<p>Sets focus in the tagsinput</p>
<pre><code data-language="javascript">$('input').tagsinput('focus');</code></pre>
</td>
</tr>
<tr>
<td><code>input</code></td>
<td>
<p>Returns the tagsinput's internal <input />, which is used for adding tags. You could use this to add your own typeahead behaviour for example.</p>
<pre><code data-language="html">var $elt = $('input').tagsinput('input');</code></pre>
</td>
</tr>
<tr>
<td><code>refresh</code></td>
<td>
<p>Refreshes the tags input UI. This might be usefull when you're adding objects as tags. When an object's text changes, you'll have to refresh to update the matching tag's text.</p>
<pre><code data-language="javascript">$('input').tagsinput('refresh');</code></pre>
</td>
</tr>
<tr>
<td><code>destroy</code></td>
<td>
<p>Removes tagsinput behaviour</p>
<pre><code data-language="javascript">$('input').tagsinput('destroy');</code></pre>
</td>
</tr>
</tbody>
</table>
</section>
<section id="methods">
<div class="page-header">
<h2>Events</h2>
</div>
<table class="table table-bordered table-condensed">
<thead>
<tr>
<th>event</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>beforeItemAdd</code></td>
<td>
Triggered just before an item gets added. Example:
<pre><code data-language="javascript">$('input').on('beforeItemAdd', function(event) {
// event.item: contains the item
// event.cancel: set to true to prevent the item getting added
});</code></pre>
</td>
</tr>
<tr>
<td><code>itemAdded</code></td>
<td>
Triggered just after an item got added. Example:
<pre><code data-language="javascript">$('input').on('itemAdded', function(event) {
// event.item: contains the item
});</code></pre>
</td>
</tr>
<tr>
<td><code>beforeItemRemove</code></td>
<td>
Triggered just before an item gets removed. Example:
<pre><code data-language="javascript">$('input').on('beforeItemRemove', function(event) {
// event.item: contains the item
// event.cancel: set to true to prevent the item getting removed
});</code></pre>
</td>
</tr>
<tr>
<td><code>itemRemoved</code></td>
<td>
Triggered just after an item got removed. Example:
<pre><code data-language="javascript">$('input').on('itemRemoved', function(event) {
// event.item: contains the item
});</code></pre>
</td>
</tr>
</tbody>
</table>
</section>
</div>
<footer class="footer">
<p>Code licensed under <a href="https://raw.github.com/TimSchlechter/bootstrap-tagsinput/master/LICENSE" target="_blank">MIT License</a></p>
</footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.20/angular.min.js"></script>
<script src="../dist/bootstrap-tagsinput.min.js"></script>
<script src="../dist/bootstrap-tagsinput/bootstrap-tagsinput-angular.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/rainbow/1.2.0/js/rainbow.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/rainbow/1.2.0/js/language/generic.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/rainbow/1.2.0/js/language/html.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/rainbow/1.2.0/js/language/javascript.js"></script>
<script src="assets/app_bs2.js"></script>
<script src="assets/app.js"></script>
</body>
</html>
index.html 0000644 00000002332 15167726216 0006556 0 ustar 00 <!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>flot.tooltip plugin example page</title>
<meta name="author" content="@kenirwin">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<h1>Flot Tooltip Examples</h1>
<ul>
<li><a href="basic.html">Basic Configuration</a></li>
<li><a href="custom-label-text.html">Custom Label Text</a></li>
<li><a href="custom_ticks.html">Custom Ticks</a></li>
<li><a href="dollar_in_tickformatter.html">Dollar in tickFormatter</a></li>
<li><a href="many_series.html">Many Series</a></li>
<li><a href="multiple-axes.html">Multiple Axes</a></li>
<li><a href="real_data.html">Real-time Data</a></li>
<li><a href="two_chars.html">Two Charts</a></li>
</ul>
<h2>Supported Plugin Examples</h2>
<ul>
<li><a href="curved-lines.html">Curved Lines</a></li>
<li><a href="pie.html">Pie</a></li>
<li><a href="stacking.html">Stacking</a></li>
<li><a href="threshold.html">Threshold</a></li>
<li><a href="time_bars.html">Time Bars</a></li>
</ul>
</li>
</body>
</html>
shared/jquery-ui/jquery-ui.min.css 0000644 00000003331 15167727110 0013201 0 ustar 00 /*! jQuery UI - v1.10.0 - 2013-01-26
* http://jqueryui.com
* Includes: jquery.ui.core.css, jquery.ui.resizable.css
* Copyright (c) 2013 jQuery Foundation and other contributors Licensed MIT */
.ui-helper-hidden{display:none}.ui-helper-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:before,.ui-helper-clearfix:after{content:"";display:table}.ui-helper-clearfix:after{clear:both}.ui-helper-clearfix{min-height:0}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-front{z-index:100}.ui-state-disabled{cursor:default!important}.ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-overlay{position:fixed;top:0;left:0;width:100%;height:100%}.ui-resizable{position:relative}.ui-resizable-handle{position:absolute;font-size:0.1px;display:block}.ui-resizable-disabled .ui-resizable-handle,.ui-resizable-autohide .ui-resizable-handle{display:none}.ui-resizable-n{cursor:n-resize;height:7px;width:100%;top:-5px;left:0}.ui-resizable-s{cursor:s-resize;height:7px;width:100%;bottom:-5px;left:0}.ui-resizable-e{cursor:e-resize;width:7px;right:-5px;top:0;height:100%}.ui-resizable-w{cursor:w-resize;width:7px;left:-5px;top:0;height:100%}.ui-resizable-se{cursor:se-resize;width:12px;height:12px;right:1px;bottom:1px}.ui-resizable-sw{cursor:sw-resize;width:9px;height:9px;left:-5px;bottom:-5px}.ui-resizable-nw{cursor:nw-resize;width:9px;height:9px;left:-5px;top:-5px}.ui-resizable-ne{cursor:ne-resize;width:9px;height:9px;right:-5px;top:-5px} symbols/index.html 0000644 00000004160 15167727110 0010241 0 ustar 00 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Flot Examples: Symbols</title>
<link href="../examples.css" rel="stylesheet" type="text/css">
<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="../../excanvas.min.js"></script><![endif]-->
<script language="javascript" type="text/javascript" src="../../jquery.js"></script>
<script language="javascript" type="text/javascript" src="../../jquery.flot.js"></script>
<script language="javascript" type="text/javascript" src="../../jquery.flot.symbol.js"></script>
<script type="text/javascript">
$(function() {
function generate(offset, amplitude) {
var res = [];
var start = 0, end = 10;
for (var i = 0; i <= 50; ++i) {
var x = start + i / 50 * (end - start);
res.push([x, amplitude * Math.sin(x + offset)]);
}
return res;
}
var data = [
{ data: generate(2, 1.8), points: { symbol: "circle" } },
{ data: generate(3, 1.5), points: { symbol: "square" } },
{ data: generate(4, 0.9), points: { symbol: "diamond" } },
{ data: generate(6, 1.4), points: { symbol: "triangle" } },
{ data: generate(7, 1.1), points: { symbol: "cross" } }
];
$.plot("#placeholder", data, {
series: {
points: {
show: true,
radius: 3
}
},
grid: {
hoverable: true
}
});
// Add the Flot version string to the footer
$("#footer").prepend("Flot " + $.plot.version + " – ");
});
</script>
</head>
<body>
<div id="header">
<h2>Symbols</h2>
</div>
<div id="content">
<div class="demo-container">
<div id="placeholder" class="demo-placeholder"></div>
</div>
<p>Points can be marked in several ways, with circles being the built-in default. For other point types, you can define a callback function to draw the symbol. Some common symbols are available in the symbol plugin.</p>
</div>
<div id="footer">
Copyright © 2007 - 2014 IOLA and Ole Laursen
</div>
</body>
</html>
percentiles/index.html 0000644 00000016204 15167727110 0011070 0 ustar 00 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Flot Examples: Percentiles</title>
<link href="../examples.css" rel="stylesheet" type="text/css">
<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="../../excanvas.min.js"></script><![endif]-->
<script language="javascript" type="text/javascript" src="../../jquery.js"></script>
<script language="javascript" type="text/javascript" src="../../jquery.flot.js"></script>
<script language="javascript" type="text/javascript" src="../../jquery.flot.fillbetween.js"></script>
<script type="text/javascript">
$(function() {
var males = {"15%": [[2, 88.0], [3, 93.3], [4, 102.0], [5, 108.5], [6, 115.7], [7, 115.6], [8, 124.6], [9, 130.3], [10, 134.3], [11, 141.4], [12, 146.5], [13, 151.7], [14, 159.9], [15, 165.4], [16, 167.8], [17, 168.7], [18, 169.5], [19, 168.0]], "90%": [[2, 96.8], [3, 105.2], [4, 113.9], [5, 120.8], [6, 127.0], [7, 133.1], [8, 139.1], [9, 143.9], [10, 151.3], [11, 161.1], [12, 164.8], [13, 173.5], [14, 179.0], [15, 182.0], [16, 186.9], [17, 185.2], [18, 186.3], [19, 186.6]], "25%": [[2, 89.2], [3, 94.9], [4, 104.4], [5, 111.4], [6, 117.5], [7, 120.2], [8, 127.1], [9, 132.9], [10, 136.8], [11, 144.4], [12, 149.5], [13, 154.1], [14, 163.1], [15, 169.2], [16, 170.4], [17, 171.2], [18, 172.4], [19, 170.8]], "10%": [[2, 86.9], [3, 92.6], [4, 99.9], [5, 107.0], [6, 114.0], [7, 113.5], [8, 123.6], [9, 129.2], [10, 133.0], [11, 140.6], [12, 145.2], [13, 149.7], [14, 158.4], [15, 163.5], [16, 166.9], [17, 167.5], [18, 167.1], [19, 165.3]], "mean": [[2, 91.9], [3, 98.5], [4, 107.1], [5, 114.4], [6, 120.6], [7, 124.7], [8, 131.1], [9, 136.8], [10, 142.3], [11, 150.0], [12, 154.7], [13, 161.9], [14, 168.7], [15, 173.6], [16, 175.9], [17, 176.6], [18, 176.8], [19, 176.7]], "75%": [[2, 94.5], [3, 102.1], [4, 110.8], [5, 117.9], [6, 124.0], [7, 129.3], [8, 134.6], [9, 141.4], [10, 147.0], [11, 156.1], [12, 160.3], [13, 168.3], [14, 174.7], [15, 178.0], [16, 180.2], [17, 181.7], [18, 181.3], [19, 182.5]], "85%": [[2, 96.2], [3, 103.8], [4, 111.8], [5, 119.6], [6, 125.6], [7, 131.5], [8, 138.0], [9, 143.3], [10, 149.3], [11, 159.8], [12, 162.5], [13, 171.3], [14, 177.5], [15, 180.2], [16, 183.8], [17, 183.4], [18, 183.5], [19, 185.5]], "50%": [[2, 91.9], [3, 98.2], [4, 106.8], [5, 114.6], [6, 120.8], [7, 125.2], [8, 130.3], [9, 137.1], [10, 141.5], [11, 149.4], [12, 153.9], [13, 162.2], [14, 169.0], [15, 174.8], [16, 176.0], [17, 176.8], [18, 176.4], [19, 177.4]]};
var females = {"15%": [[2, 84.8], [3, 93.7], [4, 100.6], [5, 105.8], [6, 113.3], [7, 119.3], [8, 124.3], [9, 131.4], [10, 136.9], [11, 143.8], [12, 149.4], [13, 151.2], [14, 152.3], [15, 155.9], [16, 154.7], [17, 157.0], [18, 156.1], [19, 155.4]], "90%": [[2, 95.6], [3, 104.1], [4, 111.9], [5, 119.6], [6, 127.6], [7, 133.1], [8, 138.7], [9, 147.1], [10, 152.8], [11, 161.3], [12, 166.6], [13, 167.9], [14, 169.3], [15, 170.1], [16, 172.4], [17, 169.2], [18, 171.1], [19, 172.4]], "25%": [[2, 87.2], [3, 95.9], [4, 101.9], [5, 107.4], [6, 114.8], [7, 121.4], [8, 126.8], [9, 133.4], [10, 138.6], [11, 146.2], [12, 152.0], [13, 153.8], [14, 155.7], [15, 158.4], [16, 157.0], [17, 158.5], [18, 158.4], [19, 158.1]], "10%": [[2, 84.0], [3, 91.9], [4, 99.2], [5, 105.2], [6, 112.7], [7, 118.0], [8, 123.3], [9, 130.2], [10, 135.0], [11, 141.1], [12, 148.3], [13, 150.0], [14, 150.7], [15, 154.3], [16, 153.6], [17, 155.6], [18, 154.7], [19, 153.1]], "mean": [[2, 90.2], [3, 98.3], [4, 105.2], [5, 112.2], [6, 119.0], [7, 125.8], [8, 131.3], [9, 138.6], [10, 144.2], [11, 151.3], [12, 156.7], [13, 158.6], [14, 160.5], [15, 162.1], [16, 162.9], [17, 162.2], [18, 163.0], [19, 163.1]], "75%": [[2, 93.2], [3, 101.5], [4, 107.9], [5, 116.6], [6, 122.8], [7, 129.3], [8, 135.2], [9, 143.7], [10, 148.7], [11, 156.9], [12, 160.8], [13, 163.0], [14, 165.0], [15, 165.8], [16, 168.7], [17, 166.2], [18, 167.6], [19, 168.0]], "85%": [[2, 94.5], [3, 102.8], [4, 110.4], [5, 119.0], [6, 125.7], [7, 131.5], [8, 137.9], [9, 146.0], [10, 151.3], [11, 159.9], [12, 164.0], [13, 166.5], [14, 167.5], [15, 168.5], [16, 171.5], [17, 168.0], [18, 169.8], [19, 170.3]], "50%": [[2, 90.2], [3, 98.1], [4, 105.2], [5, 111.7], [6, 118.2], [7, 125.6], [8, 130.5], [9, 138.3], [10, 143.7], [11, 151.4], [12, 156.7], [13, 157.7], [14, 161.0], [15, 162.0], [16, 162.8], [17, 162.2], [18, 162.8], [19, 163.3]]};
var dataset = [
{ label: "Female mean", data: females["mean"], lines: { show: true }, color: "rgb(255,50,50)" },
{ id: "f15%", data: females["15%"], lines: { show: true, lineWidth: 0, fill: false }, color: "rgb(255,50,50)" },
{ id: "f25%", data: females["25%"], lines: { show: true, lineWidth: 0, fill: 0.2 }, color: "rgb(255,50,50)", fillBetween: "f15%" },
{ id: "f50%", data: females["50%"], lines: { show: true, lineWidth: 0.5, fill: 0.4, shadowSize: 0 }, color: "rgb(255,50,50)", fillBetween: "f25%" },
{ id: "f75%", data: females["75%"], lines: { show: true, lineWidth: 0, fill: 0.4 }, color: "rgb(255,50,50)", fillBetween: "f50%" },
{ id: "f85%", data: females["85%"], lines: { show: true, lineWidth: 0, fill: 0.2 }, color: "rgb(255,50,50)", fillBetween: "f75%" },
{ label: "Male mean", data: males["mean"], lines: { show: true }, color: "rgb(50,50,255)" },
{ id: "m15%", data: males["15%"], lines: { show: true, lineWidth: 0, fill: false }, color: "rgb(50,50,255)" },
{ id: "m25%", data: males["25%"], lines: { show: true, lineWidth: 0, fill: 0.2 }, color: "rgb(50,50,255)", fillBetween: "m15%" },
{ id: "m50%", data: males["50%"], lines: { show: true, lineWidth: 0.5, fill: 0.4, shadowSize: 0 }, color: "rgb(50,50,255)", fillBetween: "m25%" },
{ id: "m75%", data: males["75%"], lines: { show: true, lineWidth: 0, fill: 0.4 }, color: "rgb(50,50,255)", fillBetween: "m50%" },
{ id: "m85%", data: males["85%"], lines: { show: true, lineWidth: 0, fill: 0.2 }, color: "rgb(50,50,255)", fillBetween: "m75%" }
];
$.plot($("#placeholder"), dataset, {
xaxis: {
tickDecimals: 0
},
yaxis: {
tickFormatter: function (v) {
return v + " cm";
}
},
legend: {
position: "se"
}
});
// Add the Flot version string to the footer
$("#footer").prepend("Flot " + $.plot.version + " – ");
});
</script>
</head>
<body>
<div id="header">
<h2>Percentiles</h2>
</div>
<div id="content">
<div class="demo-container">
<div id="placeholder" class="demo-placeholder"></div>
</div>
<p>Height in centimeters of individuals from the US (2003-2006) as function of age in years (source: <a href="http://www.cdc.gov/nchs/data/nhsr/nhsr010.pdf">CDC</a>). The 15%-85%, 25%-75% and 50% percentiles are indicated.</p>
<p>For each point of a filled curve, you can specify an arbitrary bottom. As this example illustrates, this can be useful for plotting percentiles. If you have the data sets available without appropriate fill bottoms, you can use the fillbetween plugin to compute the data point bottoms automatically.</p>
</div>
<div id="footer">
Copyright © 2007 - 2014 IOLA and Ole Laursen
</div>
</body>
</html>
axes-interacting/index.html 0000644 00000005565 15167727110 0012030 0 ustar 00 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Flot Examples: Interacting with axes</title>
<link href="../examples.css" rel="stylesheet" type="text/css">
<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="../../excanvas.min.js"></script><![endif]-->
<script language="javascript" type="text/javascript" src="../../jquery.js"></script>
<script language="javascript" type="text/javascript" src="../../jquery.flot.js"></script>
<script type="text/javascript">
$(function() {
function generate(start, end, fn) {
var res = [];
for (var i = 0; i <= 100; ++i) {
var x = start + i / 100 * (end - start);
res.push([x, fn(x)]);
}
return res;
}
var data = [
{ data: generate(0, 10, function (x) { return Math.sqrt(x);}), xaxis: 1, yaxis:1 },
{ data: generate(0, 10, function (x) { return Math.sin(x);}), xaxis: 1, yaxis:2 },
{ data: generate(0, 10, function (x) { return Math.cos(x);}), xaxis: 1, yaxis:3 },
{ data: generate(2, 10, function (x) { return Math.tan(x);}), xaxis: 2, yaxis: 4 }
];
var plot = $.plot("#placeholder", data, {
xaxes: [
{ position: 'bottom' },
{ position: 'top'}
],
yaxes: [
{ position: 'left' },
{ position: 'left' },
{ position: 'right' },
{ position: 'left' }
]
});
// Create a div for each axis
$.each(plot.getAxes(), function (i, axis) {
if (!axis.show)
return;
var box = axis.box;
$("<div class='axisTarget' style='position:absolute; left:" + box.left + "px; top:" + box.top + "px; width:" + box.width + "px; height:" + box.height + "px'></div>")
.data("axis.direction", axis.direction)
.data("axis.n", axis.n)
.css({ backgroundColor: "#f00", opacity: 0, cursor: "pointer" })
.appendTo(plot.getPlaceholder())
.hover(
function () { $(this).css({ opacity: 0.10 }) },
function () { $(this).css({ opacity: 0 }) }
)
.click(function () {
$("#click").text("You clicked the " + axis.direction + axis.n + "axis!")
});
});
// Add the Flot version string to the footer
$("#footer").prepend("Flot " + $.plot.version + " – ");
});
</script>
</head>
<body>
<div id="header">
<h2>Interacting with axes</h2>
</div>
<div id="content">
<div class="demo-container">
<div id="placeholder" class="demo-placeholder"></div>
</div>
<p>With multiple axes, you sometimes need to interact with them. A simple way to do this is to draw the plot, deduce the axis placements and insert a couple of divs on top to catch events.</p>
<p>Try clicking an axis.</p>
<p id="click"></p>
</div>
<div id="footer">
Copyright © 2007 - 2014 IOLA and Ole Laursen
</div>
</body>
</html>
resize/index.html 0000644 00000004606 15167727110 0010057 0 ustar 00 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Flot Examples: Resizing</title>
<link href="../examples.css" rel="stylesheet" type="text/css">
<link href="../shared/jquery-ui/jquery-ui.min.css" rel="stylesheet" type="text/css">
<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="../../excanvas.min.js"></script><![endif]-->
<script language="javascript" type="text/javascript" src="../../jquery.js"></script>
<script language="javascript" type="text/javascript" src="../shared/jquery-ui/jquery-ui.min.js"></script>
<script language="javascript" type="text/javascript" src="../../jquery.flot.js"></script>
<script language="javascript" type="text/javascript" src="../../jquery.flot.resize.js"></script>
<script type="text/javascript">
$(function() {
var d1 = [];
for (var i = 0; i < 14; i += 0.5) {
d1.push([i, Math.sin(i)]);
}
var d2 = [[0, 3], [4, 8], [8, 5], [9, 13]];
var d3 = [[0, 12], [7, 12], null, [7, 2.5], [12, 2.5]];
var placeholder = $("#placeholder");
var plot = $.plot(placeholder, [d1, d2, d3]);
// The plugin includes a jQuery plugin for adding resize events to any
// element. Add a callback so we can display the placeholder size.
placeholder.resize(function () {
$(".message").text("Placeholder is now "
+ $(this).width() + "x" + $(this).height()
+ " pixels");
});
$(".demo-container").resizable({
maxWidth: 900,
maxHeight: 500,
minWidth: 450,
minHeight: 250
});
// Add the Flot version string to the footer
$("#footer").prepend("Flot " + $.plot.version + " – ");
});
</script>
</head>
<body>
<div id="header">
<h2>Resizing</h2>
</div>
<div id="content">
<div class="demo-container">
<div id="placeholder" class="demo-placeholder"></div>
</div>
<p class="message"></p>
<p>Sometimes it makes more sense to just let the plot take up the available space. In that case, we need to redraw the plot each time the placeholder changes its size. If you include the resize plugin, this is handled automatically.</p>
<p>Drag the bottom and right sides of the plot to resize it.</p>
</div>
<div id="footer">
Copyright © 2007 - 2014 IOLA and Ole Laursen
</div>
</body>
</html>
background.png 0000644 00000000347 15167727110 0007404 0 ustar 00 �PNG
IHDR � �u% gAMA ��7�� tEXtSoftware Adobe ImageReadyq�e<