jqwidgets-scripts-custom
Version:
jQWidgets is an advanced jQuery, Angular 7, Vue, React, ASP .NET MVC, Custom Elements and HTML5 UI framework.
141 lines (119 loc) • 6.16 kB
HTML
<html lang="en">
<head>
<title id='Description'>Custom Element Chart BubbleSeries</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1 maximum-scale=1 minimum-scale=1" />
<meta name="description" content="This is an example of Custom Element Bubble Chart Component" />
<link rel="stylesheet" href="../../../jqwidgets/styles/jqx.base.css" type="text/css" />
<link rel="stylesheet" href="../../../styles/demos.css" type="text/css" />
<script type="text/javascript" src="../../../scripts/webcomponents-lite.min.js"></script>
<script type="text/javascript" src="../../../jqwidgets/jqxcore.js"></script>
<script type="text/javascript" src="../../../jqwidgets/jqxcore.elements.js"></script>
<script type="text/javascript" src="../../../jqwidgets/jqxdata.js"></script>
<script type="text/javascript" src="../../../jqwidgets/jqxdraw.js"></script>
<script type="text/javascript" src="../../../jqwidgets/jqxchart.core.js"></script>
<script type="text/javascript" src="../../../jqwidgets/jqxbuttons.js"></script>
<script type="text/javascript" src="../../../jqwidgets/jqxlistbox.js"></script>
<script type="text/javascript" src="../../../jqwidgets/jqxscrollbar.js"></script>
<script type="text/javascript" src="../../../jqwidgets/jqxdropdownlist.js"></script>
<script type="text/javascript" src="../../../scripts/demos.js"></script>
<script>
var sampleData = [
{ City: 'New York', SalesQ1: 310500, SalesQ2: 210500, YoYGrowthQ1: 1.05, YoYGrowthQ2: 1.25 },
{ City: 'London', SalesQ1: 120000, SalesQ2: 169000, YoYGrowthQ1: 1.15, YoYGrowthQ2: 0.95 },
{ City: 'Paris', SalesQ1: 205000, SalesQ2: 275500, YoYGrowthQ1: 1.45, YoYGrowthQ2: 1.15 },
{ City: 'Tokyo', SalesQ1: 187000, SalesQ2: 130100, YoYGrowthQ1: 0.45, YoYGrowthQ2: 0.55 },
{ City: 'Berlin', SalesQ1: 187000, SalesQ2: 113000, YoYGrowthQ1: 1.65, YoYGrowthQ2: 1.05 },
{ City: 'San Francisco', SalesQ1: 142000, SalesQ2: 102000, YoYGrowthQ1: 0.75, YoYGrowthQ2: 0.15 },
{ City: 'Chicago', SalesQ1: 171000, SalesQ2: 124000, YoYGrowthQ1: 0.75, YoYGrowthQ2: 0.65 }
];
var symbolsList = ["circle", "diamond", "square", "triangle_up", "triangle_down", "triangle_left", "triangle_right"];
JQXElements.settings["chartSettings"] = {
title: "Sales by City in Q1 and Q2, and YoY sales growth",
description: "(the size of the circles represents relative YoY growth)",
enableAnimations: true,
showLegend: true,
padding: { left: 5, top: 5, right: 5, bottom: 5 },
titlePadding: { left: 90, top: 0, right: 0, bottom: 10 },
source: sampleData,
colorScheme: 'scheme04',
xAxis:
{
dataField: 'City',
valuesOnTicks: false
},
valueAxis:
{
unitInterval: 50000,
minValue: 50000,
maxValue: 350000,
title: { text: 'Sales ($)<br>' },
labels: {
formatSettings: { prefix: '$', thousandsSeparator: ',' },
horizontalAlignment: 'right'
}
},
seriesGroups:
[
{
type: 'bubble',
series: [
{ dataField: 'SalesQ1', radiusDataField: 'YoYGrowthQ1', minRadius: 10, maxRadius: 30, displayText: 'Sales in Q1' },
{ dataField: 'SalesQ2', radiusDataField: 'YoYGrowthQ2', minRadius: 10, maxRadius: 30, displayText: 'Sales in Q2' }
]
}
]
};
JQXElements.settings['DropDownSerie1Symbol'] = {
source: symbolsList,
selectedIndex: 0,
dropDownHeight: 100
};
JQXElements.settings['DropDownSerie2Symbol'] = {
source: symbolsList,
selectedIndex: 0,
dropDownHeight: 100
};
window.onload = function() {
var myChart = document.querySelector('jqx-chart');
var myDropDownList = document.querySelectorAll('jqx-drop-down-list');
var chart = myChart.getInstance();
myDropDownList[0].addEventListener('change', function(event) {
var value = event.args.item.value;
chart.seriesGroups[0].series[0].symbolType = value;
chart.update();
});
myDropDownList[1].addEventListener('change', function(event) {
var value = event.args.item.value;
chart.seriesGroups[0].series[1].symbolType = value;
chart.update();
});
};
</script>
</head>
<body>
<jqx-chart settings="chartSettings" style="width:850px; height:500px;"></jqx-chart>
<table style="width: 550px">
<tr>
<td>
<p style="font-family: Verdana; font-size: 12px;">
Select Serie 1 Symbol:
</p>
<jqx-drop-down-list settings='DropDownSerie1Symbol'>
</jqx-drop-down-list>
</td>
<td>
<p style="font-family: Verdana; font-size: 12px;">
Select Serie 2 Symbol:
</p>
<jqx-drop-down-list settings='DropDownSerie2Symbol'>
</jqx-drop-down-list>
</td>
</tr>
</table>
<div class="example-description">
This is an example of Custom element Bubble Chart. The bubble chart is used to represent data with three dimensions where two of the values are plotted through the x and y location and the third through the size. You can see how to change the bubble shape with the symbol type setting.
</div>
</body>
</html>