UNPKG

jqwidgets-scripts-custom

Version:

jQWidgets is an advanced jQuery, Angular 7, Vue, React, ASP .NET MVC, Custom Elements and HTML5 UI framework.

127 lines (118 loc) 6.19 kB
<!DOCTYPE html> <html lang="en"> <head> <title id='Description'>Custom Element Chart PartialPieSeries</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 Custom Element Chart is devided in a pie series." /> <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="../../../scripts/demos.js"></script> <script> var dataStatCounter = [ { Browser: 'Chrome', Share: 45.6 }, { Browser: 'IE', Share: 24.6 }, { Browser: 'Firefox', Share: 20.4 }, { Browser: 'Safari', Share: 5.1 }, { Browser: 'Opera', Share: 1.3 }, { Browser: 'Other', Share: 3.0 } ]; var dataW3CCounter = [ { Browser: 'Chrome', Share: 34.1 }, { Browser: 'IE', Share: 20.3 }, { Browser: 'Firefox', Share: 18.3 }, { Browser: 'Safari', Share: 17.8 }, { Browser: 'Opera', Share: 2.7 }, { Browser: 'Other', Share: 6.8 } ]; var dataWikimedia = [ { Browser: 'Chrome', Share: 42.7 }, { Browser: 'IE', Share: 18.0 }, { Browser: 'Firefox', Share: 15.3 }, { Browser: 'Safari', Share: 6.1 }, { Browser: 'Opera', Share: 2.4 }, { Browser: 'Other', Share: 15.6 } ]; var dataNetApplications = [ { Browser: 'Chrome', Share: 16.4 }, { Browser: 'IE', Share: 55.2 }, { Browser: 'Firefox', Share: 18.0 }, { Browser: 'Safari', Share: 5.8 }, { Browser: 'Opera', Share: 1.3 }, { Browser: 'Other', Share: 3.4 } ]; var chartsData = [ { title: 'Stat counter', label: 'Stat', dataSource: dataStatCounter }, { title: 'W3C counter', label: 'W3C', dataSource: dataW3CCounter }, { title: 'Wikimedia', label: 'Wikimedia', dataSource: dataWikimedia }, { title: 'Net Applications', label: 'NetApp', dataSource: dataNetApplications } ]; window.onload = function() { for(var i = 0; i < chartsData.length; i++) { var myChart = document.createElement('jqx-chart'); myChart.style.cssText = 'width:400px; height:250px; float: left'; myChart.settings = { title: '', source: chartsData[i].dataSource, description: chartsData[i].title, enableAnimations: false, showLegend: true, showBorderLine: true, padding: { left: 5, top: 5, right: 5, bottom: 5 }, titlePadding: { left: 0, top: 0, right: 0, bottom: 10 }, colorScheme: 'scheme03', seriesGroups: [ { type: 'pie', showLegend: true, enableSeriesToggle: true, series: [ { dataField: 'Share', displayText: 'Browser', showLabels: true, labelRadius: 160, labelLinesEnabled: true, labelLinesAngles: true, labelsAutoRotate: false, initialAngle: 0, radius: 125, minAngle: 0, maxAngle: 180, centerOffset: 0, offsetY: 170, formatFunction: (value, itemIdx, serieIndex, groupIndex) => { if (isNaN(value)) return value; return value + '%'; } } ] } ] }; document.body.appendChild(myChart); } }; </script> </head> <body> <div class="example-description"> This is an example of Custom Element chart partial pie series. You can see how to enable labels on the lines of the pie chart and how to set the angles of the labels. You can also see how to enable toggle of the pie chart series. </div> </body> </html>