Skip to content

Commit d0560dd

Browse files
author
pipeline
committed
config(EJ2-2116): lineargauge added
1 parent 5734667 commit d0560dd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+2087
-2
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"@syncfusion/ej2-popups": "*",
1818
"@syncfusion/ej2-charts": "*",
1919
"@syncfusion/ej2-circulargauge": "*",
20+
"@syncfusion/ej2-lineargauge": "*",
2021
"@syncfusion/ej2-navigations": "*",
2122
"cheerio": "^1.0.0-rc.1",
2223
"crossroads": "^0.12.2",

src/common/sampleList.ts

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/common/sampleOrder.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"Data Visualization": ["Chart", "Circular Gauge"],
2+
"Data Visualization": ["Chart", "Circular Gauge", "Linear Gauge"],
33
"Grids": ["Grid"],
44
"Editors": ["Form Validator", "DropDownList", "Calendar", "NumericTextBox", "Button", "TextBoxes"],
55
"Layout": ["ListView", "Dialog", "Popup", "Tooltip"],
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"index.ts":"import { LinearGauge, Annotations, ILoadEventArgs } from '@syncfusion/ej2-lineargauge';\nLinearGauge.Inject(Annotations);\n\n/**\n * Default linear gauge\n */\nlet gauge: LinearGauge;\n\n let count: number = 0;\n gauge = new LinearGauge({\n rangePalettes: ['#30b32d', '#ffdd00', '#f03e3e'],\n orientation: 'Horizontal',\n axes: [{\n maximum: 90,\n labelStyle: {\n font: {\n size: '0px'\n }\n },\n line: {\n width: 0\n },\n pointers: [\n {\n value: 35,\n height: 15,\n width: 15,\n color: '#757575',\n placement: 'Near',\n markerType: 'Triangle',\n offset: -50\n }\n ],\n majorTicks: {\n interval: 10,\n height: 0\n },\n minorTicks: {\n height: 0\n },\n ranges: [{\n start: 0,\n end: 30,\n startWidth: 50,\n endWidth: 50\n },\n {\n start: 30,\n end: 60,\n startWidth: 50,\n endWidth: 50\n },\n {\n start: 60,\n end: 90,\n startWidth: 50,\n endWidth: 50\n }]\n }],\n load: gaugeLoad\n });\n gauge.appendTo('#annotationContainer');\n\n\nfunction gaugeLoad(args: ILoadEventArgs): void {\n if (this.count === undefined) {\n gauge.annotations = [\n {\n content: '<div id=\"title\" style=\"width:200px;\"><p style=\"font-size:18px;\">CPU Utilization</p></div>',\n horizontalAlignment: 'Center',\n x: 35,\n y: 50\n },\n {\n content: '<div id=\"low\"><img style=\"height:25px;width:25px;\" src=\"http://npmci.syncfusion.com/production/demos/src/lineargauge/images/Low.png\"/></div>',\n axisIndex: 0,\n axisValue: 15,\n y: -25,\n zIndex: '1'\n },\n {\n content: '<div id=\"moderate\"><img style=\"height:25px;width:25px;\" src=\"http://npmci.syncfusion.com/production/demos/src/lineargauge/images/Moderate.png\"/></div>',\n axisIndex: 0,\n axisValue: 45,\n y: -25,\n zIndex: '1'\n },\n {\n content: '<div id=\"high\"><img style=\"height:25px;width:25px;\" src=\"http://npmci.syncfusion.com/production/demos/src/lineargauge/images/High.png\"/></div>',\n axisIndex: 0,\n axisValue: 75,\n y: -25,\n zIndex: '1'\n },\n {\n content: '<div id=\"lowText\"><p style=\"font-size:15px;color:#248622;\">Low</p></div>',\n axisIndex: 0,\n axisValue: 15,\n y: 20\n },\n {\n content: '<div id=\"moderateText\"><p style=\"font-size:15px;color:#ba9e2a;\">Moderate</p></div>',\n axisIndex: 0,\n axisValue: 45,\n y: 20\n },\n {\n content: '<div id=\"highText\"><p style=\"font-size:15px;color:#b42f2f;\">High</p></div>',\n axisIndex: 0,\n axisValue: 75,\n y: 20\n }\n ];\n this.count = 0;\n gauge.refresh();\n }\n}\n\n\n\n","index.html":"<html><head>\n <link href=\"http://npmci.syncfusion.com/packages/production/material.css\" rel=\"stylesheet\">\n <script src=\"https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js\"></script>\n <script src=\"systemjs.config.js\"></script>\n</head>\n<body>\n<div class=\"control-section\">\n <div id=\"annotationContainer\">\n\n </div>\n</div>\n<div id=\"description \">\n <p>\n In this sample we have used annotations to indicate low, moderate and high ranges. Annotations are used to place the texts,\n shapes or images anywhere in the gauge. You can use <code>content</code>, <code>x</code>, <code>y</code>,\n <code>zIndex</code> properties to customize the annotations. And you can specify the id of the element that needs\n to be displayed, in the content property.\n <br>\n </p><p style=\"font-weight: 500 \">Injecting Module</p>\n <p>\n Linear gauge component features are segregated into individual feature-wise modules. To render annotations, we need to inject\n <code>Annotations</code> module using <code>LinearGauge.Inject(LinearGauge)</code> method.\n </p>\n <p>\n More information about annotations can be found in this\n <a target=\"_blank \" href=\"http://ej2.syncfusion.com/documentation \">documentation section</a>.\n </p>\n</div>\n<style>\n #control-container {\n padding: 0px !important;\n }\n /* Set black background color, white text and some padding */\n\n #templateWrap img {\n border-radius: 30px;\n width: 30px;\n height: 30px;\n margin: 0 auto;\n }\n\n #templateWrap .des {\n float: right;\n padding-left: 10px;\n line-height: 30px;\n }\n\n p {\n padding: 0.5em;\n font-size: 16px;\n }\n\n #targetContainer .text-center {\n color: rgba(0, 0, 0, 0.54);\n }\n</style>\n\n</body></html>","systemjs.config.js":"System.config({\n transpiler: \"typescript\",\n typescriptOptions: {\n compilerOptions: {\n target: \"umd\",\n module: \"commonjs\",\n moduleResolution: \"node\",\n emitDecoratorMetadata: true,\n experimentalDecorators: true\n }\n },\n paths: {\n \"syncfusion:\": \"http://npmci.syncfusion.com/packages/production/\"\n },\n map: {\n main: \"index.ts\",\n typescript: \"https://unpkg.com/[email protected]/lib/typescript.js\",\n 'plugin-json':'https://cdnjs.cloudflare.com/ajax/libs/systemjs-plugin-json/0.3.0/json.min.js',\n \"@syncfusion/ej2-base\": \"syncfusion:ej2-base/dist/ej2-base.umd.min.js\",\n \"@syncfusion/ej2-buttons\": \"syncfusion:ej2-buttons/dist/ej2-buttons.umd.min.js\",\n \"@syncfusion/ej2-calendars\": \"syncfusion:ej2-calendars/dist/ej2-calendars.umd.min.js\",\n \"@syncfusion/ej2-charts\": \"syncfusion:ej2-charts/dist/ej2-charts.umd.min.js\",\n \"@syncfusion/ej2-circulargauge\": \"syncfusion:ej2-circulargauge/dist/ej2-circulargauge.umd.min.js\",\n \"@syncfusion/ej2-data\": \"syncfusion:ej2-data/dist/ej2-data.umd.min.js\",\n \"@syncfusion/ej2-dropdowns\": \"syncfusion:ej2-dropdowns/dist/ej2-dropdowns.umd.min.js\",\n \"@syncfusion/ej2-grids\": \"syncfusion:ej2-grids/dist/ej2-grids.umd.min.js\", \n \"@syncfusion/ej2-inputs\": \"syncfusion:ej2-inputs/dist/ej2-inputs.umd.min.js\", \n \"@syncfusion/ej2-lists\": \"syncfusion:ej2-lists/dist/ej2-lists.umd.min.js\",\n \"@syncfusion/ej2-navigations\": \"syncfusion:ej2-navigations/dist/ej2-navigations.umd.min.js\", \n \"@syncfusion/ej2-popups\": \"syncfusion:ej2-popups/dist/ej2-popups.umd.min.js\"\n },\n meta: { \n '*.json': { loader: 'plugin-json' }\n }\n});\nSystem.import('index.ts').catch(console.error.bind(console));"}

src/lineargauge/annotation.html

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<div class="control-section">
2+
<div id="annotationContainer">
3+
4+
</div>
5+
</div>
6+
<div id="description ">
7+
<p>
8+
In this sample we have used annotations to indicate low, moderate and high ranges. Annotations are used to place the texts,
9+
shapes or images anywhere in the gauge. You can use <code>content</code>, <code>x</code>, <code>y</code>,
10+
<code>zIndex</code> properties to customize the annotations. And you can specify the id of the element that needs
11+
to be displayed, in the content property.
12+
<br>
13+
<p style="font-weight: 500 ">Injecting Module</p>
14+
<p>
15+
Linear gauge component features are segregated into individual feature-wise modules. To render annotations, we need to inject
16+
<code>Annotations</code> module using <code>LinearGauge.Inject(LinearGauge)</code> method.
17+
</p>
18+
<p>
19+
More information about annotations can be found in this
20+
<a target="_blank " href="http://ej2.syncfusion.com/documentation ">documentation section</a>.
21+
</p>
22+
</div>
23+
<style>
24+
#control-container {
25+
padding: 0px !important;
26+
}
27+
/* Set black background color, white text and some padding */
28+
29+
#templateWrap img {
30+
border-radius: 30px;
31+
width: 30px;
32+
height: 30px;
33+
margin: 0 auto;
34+
}
35+
36+
#templateWrap .des {
37+
float: right;
38+
padding-left: 10px;
39+
line-height: 30px;
40+
}
41+
42+
p {
43+
padding: 0.5em;
44+
font-size: 16px;
45+
}
46+
47+
#targetContainer .text-center {
48+
color: rgba(0, 0, 0, 0.54);
49+
}
50+
</style>

src/lineargauge/annotation.ts

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
import { LinearGauge, Annotations, ILoadEventArgs } from '@syncfusion/ej2-lineargauge';
2+
LinearGauge.Inject(Annotations);
3+
4+
/**
5+
* Default linear gauge
6+
*/
7+
let gauge: LinearGauge;
8+
this.default = (): void => {
9+
let count: number = 0;
10+
gauge = new LinearGauge({
11+
rangePalettes: ['#30b32d', '#ffdd00', '#f03e3e'],
12+
orientation: 'Horizontal',
13+
axes: [{
14+
maximum: 90,
15+
labelStyle: {
16+
font: {
17+
size: '0px'
18+
}
19+
},
20+
line: {
21+
width: 0
22+
},
23+
pointers: [
24+
{
25+
value: 35,
26+
height: 15,
27+
width: 15,
28+
color: '#757575',
29+
placement: 'Near',
30+
markerType: 'Triangle',
31+
offset: -50
32+
}
33+
],
34+
majorTicks: {
35+
interval: 10,
36+
height: 0
37+
},
38+
minorTicks: {
39+
height: 0
40+
},
41+
ranges: [{
42+
start: 0,
43+
end: 30,
44+
startWidth: 50,
45+
endWidth: 50
46+
},
47+
{
48+
start: 30,
49+
end: 60,
50+
startWidth: 50,
51+
endWidth: 50
52+
},
53+
{
54+
start: 60,
55+
end: 90,
56+
startWidth: 50,
57+
endWidth: 50
58+
}]
59+
}],
60+
load: gaugeLoad
61+
});
62+
gauge.appendTo('#annotationContainer');
63+
};
64+
65+
function gaugeLoad(args: ILoadEventArgs): void {
66+
if (this.count === undefined) {
67+
gauge.annotations = [
68+
{
69+
content: '<div id="title" style="width:200px;"><p style="font-size:18px;">CPU Utilization</p></div>',
70+
horizontalAlignment: 'Center',
71+
x: 35,
72+
y: 50
73+
},
74+
{
75+
content: '<div id="low"><img style="height:25px;width:25px;" src="src/lineargauge/images/Low.png"/></div>',
76+
axisIndex: 0,
77+
axisValue: 15,
78+
y: -25,
79+
zIndex: '1'
80+
},
81+
{
82+
content: '<div id="moderate"><img style="height:25px;width:25px;" src="src/lineargauge/images/Moderate.png"/></div>',
83+
axisIndex: 0,
84+
axisValue: 45,
85+
y: -25,
86+
zIndex: '1'
87+
},
88+
{
89+
content: '<div id="high"><img style="height:25px;width:25px;" src="src/lineargauge/images/High.png"/></div>',
90+
axisIndex: 0,
91+
axisValue: 75,
92+
y: -25,
93+
zIndex: '1'
94+
},
95+
{
96+
content: '<div id="lowText"><p style="font-size:15px;color:#248622;">Low</p></div>',
97+
axisIndex: 0,
98+
axisValue: 15,
99+
y: 20
100+
},
101+
{
102+
content: '<div id="moderateText"><p style="font-size:15px;color:#ba9e2a;">Moderate</p></div>',
103+
axisIndex: 0,
104+
axisValue: 45,
105+
y: 20
106+
},
107+
{
108+
content: '<div id="highText"><p style="font-size:15px;color:#b42f2f;">High</p></div>',
109+
axisIndex: 0,
110+
axisValue: 75,
111+
y: 20
112+
}
113+
];
114+
this.count = 0;
115+
gauge.refresh();
116+
}
117+
}
118+
119+
120+

0 commit comments

Comments
 (0)