forked from syncfusion/ej2-aspnetcore-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRangeBand.cshtml
202 lines (192 loc) · 7.48 KB
/
RangeBand.cshtml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
@using Syncfusion.EJ2.Charts;
@section ControlsSection {
@{
var data = new[] {
new { id= 1, name= "Product A",previousYear= 10, lastYear= 20 },
new { id= 2, name= "Product B",previousYear= 20, lastYear= 30 },
new { id= 3, name= "Product C",previousYear= 30, lastYear= 20 },
new { id= 4, name= "Product D",previousYear= 40, lastYear= 10 },
new { id= 5, name= "Product E",previousYear= 20, lastYear= 30 },
};
}
<div class="col-lg-8 control-section">
<div id="spark-container" class="row">
<div class="cols-sample-area" align="center">
<p>
<font size=4px> Sales Growth Comparison with various Products</font>
</p>
<script type="text/x-template" id="columnTemplate1">
<div id="sparkline2010${id}" />
</script>
<script type="text/x-template" id="columnTemplate2">
<div id="sparkline2011${id}" />
</script>
<div id="Grid">
<ejs-grid id="Grid" created="gridLoaded" dataSource="data" allowSelection="false" enableColumnVirtualization="false" enableHover="true" height="400px">
<e-grid-columns>
<e-grid-column field="name" headerText="Name" textAlign="@Syncfusion.EJ2.Grids.TextAlign.Right" width="150"></e-grid-column>
<e-grid-column headerText="2010" template="#columnTemplate1" textAlign="@Syncfusion.EJ2.Grids.TextAlign.Center" width="200"></e-grid-column>
<e-grid-column headerText="2011" template="#columnTemplate2" textAlign="@Syncfusion.EJ2.Grids.TextAlign.Center" width="200"></e-grid-column>
</e-grid-columns>
</ejs-grid>
</div>
</div>
</div>
</div>
<div class="col-lg-4 property-section">
<br>
<table id="property" style="width:100%" title="Properties">
<tbody>
<tr style="height: 30px ">
<td style="width: 50% ">
Range Band Min 1
</td>
<td style="width: 50% ">
<div id="range-min"></div>
</td>
</tr>
<tr style="height: 30px ">
<td style="width: 50% ">
Range Band Max 3
</td>
<td style="width: 50% ">
<div id="range-max"></div>
</td>
</tr>
</tbody>
</table>
</div>
@*custom code start*@
<style>
td {
padding: 10px;
}
.e-headertext {
font-weight: bolder;
}
#range-min > * {
padding: 0px !important;
}
#range-max > * {
padding: 0px !important;
}
</style>
@*custom code end*@
<script type="text/javascript">
var lineData = [
[0, 6, 4, 1, 3, 2, 5],
[5, 4, 6, 3, 1, 2, 0],
[6, 4, 0, 3, 2, 5, 1],
[4, 6, 3, 0, 1, 2, 5],
[3, 5, 6, 4, 0, 1, 2],
[1, 3, 4, 2, 5, 0, 6],
[2, 4, 0, 3, 5, 6, 1],
[5, 4, 6, 3, 1, 2, 0],
[0, 6, 4, 1, 3, 2, 5],
[6, 4, 0, 3, 2, 5, 1],
[4, 6, 3, 0, 1, 2, 5],
[3, 5, 6, 4, 0, 1, 2],
[1, 3, 4, 2, 5, 0, 6],
[2, 4, 0, 3, 5, 6, 1],
[5, 4, 6, 3, 1, 2, 0],
[0, 6, 4, 1, 3, 2, 5],
[6, 4, 0, 3, 2, 5, 1],
[4, 6, 3, 0, 1, 2, 5],
[2, 4, 0, 3, 5, 6, 1],
[3, 5, 6, 4, 0, 1, 2],
[1, 3, 4, 2, 5, 0, 6]
];
var firstSparkLines = [];
var secondSparkLines = [];
window.onload = function () {
var slider1 = new ej.inputs.Slider(
{
value: 1,
change: sliderChange1,
max: 6, min: 0, type: 'MinRange',
},
'#range-min');
var slider2 = new ej.inputs.Slider(
{
value: 3,
change: sliderChange2,
max: 6, min: 0, type: 'MinRange',
},
'#range-max');
}
function gridLoaded(args) {
setTimeout(() => {
for (var i = 1; i <= 5; i++) {
var first = new ej.charts.Sparkline({
height: '50px',
width: '150px',
lineWidth: 2,
fill: '#0d3c9b',
dataSource: lineData[0],
rangeBandSettings: [
{
startRange: 1, endRange: 3, color: '#bfd4fc'
}
]
});
first.dataSource = lineData[i];
firstSparkLines.push(first);
first.appendTo('#sparkline2010' + i);
var second = new ej.charts.Sparkline({
height: '50px',
width: '150px',
lineWidth: 2,
fill: '#0d3c9b',
dataSource: lineData[0],
rangeBandSettings: [
{
startRange: 1, endRange: 3, color: '#bfd4fc'
}
]
});
second.dataSource = lineData[i + 5];
second.appendTo('#sparkline2011' + i);
secondSparkLines.push(second);
}
}, 1000);
}
function sliderChange1(e) {
for (var i = 1; i <= 5; i++) {
var first = document.getElementById("sparkline2010" + i).ej2_instances[0];
var second = document.getElementById("sparkline2011" + i).ej2_instances[0];
first.rangeBandSettings[0].startRange = Number(e.value);
second.rangeBandSettings[0].startRange = Number(e.value);
first.refresh();
second.refresh();
}
};
function sliderChange2(e) {
for (var i = 1; i <= 5; i++) {
var first = document.getElementById("sparkline2010" + i).ej2_instances[0];
var second = document.getElementById("sparkline2011" + i).ej2_instances[0];
first.rangeBandSettings[0].endRange = Number(e.value);
second.rangeBandSettings[0].endRange = Number(e.value);
first.refresh();
second.refresh();
}
};
</script>
}
@section Meta{
<meta name="description" content="This demo for Essential JS2 Sparkline control depicts the range band feature and its customization options." />
}
@section ActionDescription{
<div id="action-description">
<p>
This sample demonstrates the range band feature and its customization available in Sparkline.
</p>
</div>
}
@section Description{
<div id="description">
<p>
In this example, you can see how to render sparkline with range band and the customization options available in range band. Here the sparklines are placed inside the Data Grid control.
</p>
</div>
}