javascript-ej1-demos/Sunburst/default.html

219 строки
7.1 KiB
HTML

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="../content/bootstrap.min.css" rel="stylesheet">
<link href="../content/ejthemes/default-theme/ej.web.all.min.css" rel="stylesheet" />
<link href="../content/default.css" rel="stylesheet" />
<link href="../content/default-responsive.css" rel="stylesheet" />
<!--[if lt IE 9]>
<script src="../scripts/jquery-1.11.3.min.js" type="text/javascript"></script>
<!--<![endif]-->
<!--[if gte IE 9]><!-->
<script src="../scripts/jquery-3.4.1.min.js" type="text/javascript"></script>
<!--<![endif]-->
<script src="../scripts/ej.web.all.min.js" type="text/javascript"></script>
<script src="../scripts/properties.js" type="text/javascript"></script>
<script src="../scripts/Sunburst_Data.js" type="text/javascript"></script>
</head>
<body>
<div class="content-container-fluid">
<div class="row">
<div class="cols-sample-area">
<div id="container">
</div>
</div>
<div id="sampleProperties">
<div class="prop-grid">
<div class="row">
<div class="col-md-3">
Start Angle
</div>
<div class="col-md-3">
<div id="startAngle">
</div>
</div>
</div>
<div class="row">
<div class="col-md-3">
End Angle
</div>
<div class="col-md-3">
<div id="endAngle">
</div>
</div>
</div>
<div class="row">
<div class="col-md-3">
Outer Radius
</div>
<div class="col-md-3">
<div id="outerRadius">
</div>
</div>
</div>
<div class="row">
<div class="col-md-3">
Inner Radius
</div>
<div class="col-md-3">
<div id="innerRadius">
</div>
</div>
</div>
<div class="row" style="margin: 10px 0;">
<div class="col-md-3">
Label Overflow Mode
</div>
<div class="col-md-3 aligntop">
<select name="selectIndex" autocomplete="off" id="overflow" style="width:100px;">
<option value="0" selected>Trim</option>
<option value="1">Hide</option>
<option value="2">None</option>
</select>
</div>
</div>
<div class="row" style="margin: 10px 0;">
<div class="col-md-3">
Label Rotation Mode
</div>
<div class="col-md-3 aligntop">
<select name="selectIndex" autocomplete="off" id="rotation" style="width:100px;">
<option value="0" selected>Angle</option>
<option value="1">Normal</option>
</select>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
$(function(){
$("#container").ejSunburstChart({
dataSource: default_DataSource,
valueMemberPath: "EmployeesCount",
levels: [
{ groupMemberPath: "Country" },
{ groupMemberPath: "JobDescription" },
{ groupMemberPath: "JobGroup" },
{ groupMemberPath: "JobRole" }
],
dataLabelSettings:{visible:true},
tooltip: { visible: true},
innerRadius: 0.2,
size: { height: "600" },
title: { text: "Employees Count" },
legend: { visible:true, position: "top" },
load: "loadSunBurstTheme",
});
var sunburst = $("#container").ejSunburstChart("instance");
var startAngle = sunburst.model.startAngle;
var endAngle = sunburst.model.endAngle;
var outer = sunburst.model.radius;
var inner = sunburst.model.innerRadius;
$("#startAngle").ejSlider({
sliderType: ej.SliderType.MinRange,
height: 12,
width:100,
value: startAngle,
minValue:0,
maxValue: 360,
change: "onchange",
slide: "onchange"
});
$("#endAngle").ejSlider({
sliderType: ej.SliderType.MinRange,
height: 12,
width:100,
value: endAngle,
minValue:0,
maxValue: 360,
change: "onchange",
slide: "onchange"
});
$("#outerRadius").ejSlider({
sliderType: ej.SliderType.MinRange,
height: 12,
width:100,
value: outer,
minValue:0,
maxValue: 1,
incrementStep: 0.1,
change: "onchange",
slide: "onchange"
});
$("#innerRadius").ejSlider({
sliderType: ej.SliderType.MinRange,
height: 12,
width:100,
value: inner,
minValue:0,
maxValue: 1,
incrementStep:0.1,
change: "onchange",
slide: "onchange"
});
});
function onchange(args) {
var sunburst = $("#container").ejSunburstChart("instance");
if (args.id == "startAngle")
sunburst.model.startAngle = args.value;
else if (args.id == "endAngle")
sunburst.model.endAngle = args.value;
else if (args.id == "outerRadius")
sunburst.model.radius = args.value;
else if (args.id == "innerRadius")
sunburst.model.innerRadius = args.value;
sunburst.redraw();
}
function labelOverFlowModeChanged(sender)
{
var option = sender.selectedText;
var sunburst = $("#container").ejSunburstChart("instance");
switch (option) {
case 'Trim':
sunburst.model.dataLabelSettings.labelOverflowMode = 'trim';
break;
case 'Hide':
sunburst.model.dataLabelSettings.labelOverflowMode = 'hide';
break;
case 'None':
sunburst.model.dataLabelSettings.labelOverflowMode = 'none';
break;
}
sunburst.redraw();
}
$("#overflow").ejDropDownList({ "change": "labelOverFlowModeChanged", width: "100px",selectedItemIndex:0 });
function labelRotationModeChanged(sender)
{
var option = sender.selectedText;
var sunburst = $("#container").ejSunburstChart("instance");
switch (option) {
case 'Angle':
sunburst.model.dataLabelSettings.labelRotationMode = 'angle';
break;
case 'Normal':
sunburst.model.dataLabelSettings.labelRotationMode = 'normal';
break;
}
sunburst.redraw();
}
$("#rotation").ejDropDownList({ "change": "labelRotationModeChanged", width: "100px",selectedItemIndex:0 });
$("#sampleProperties").ejPropertiesPanel();
</script>
</body>
</html>