Skip to content

Commit 8a9949d

Browse files
author
pipeline
committed
config(EJ2-2116): lineargauge added
1 parent b5dd742 commit 8a9949d

Some content is hidden

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

51 files changed

+2376
-0
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"@syncfusion/ej2-ng-grids": "*",
2525
"@syncfusion/ej2-ng-charts": "*",
2626
"@syncfusion/ej2-ng-circulargauge": "*",
27+
"@syncfusion/ej2-ng-lineargauge": "*",
2728
"@syncfusion/ej2-ng-dropdowns": "*",
2829
"@syncfusion/ej2-ng-calendars": "*",
2930
"@syncfusion/ej2-ng-navigations": "*",

src/common/samplelist.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { calendarAppRoutes } from '../calendar/calendar.module';
99
import { chartAppRoutes } from '../chart/chart.module';
1010
import { dialogAppRoutes } from '../dialog/dialog.module';
1111
import { circulargaugeAppRoutes } from '../circulargauge/circulargauge.module';
12+
import { lineargaugeAppRoutes } from '../lineargauge/lineargauge.module';
1213
import { textboxesAppRoutes } from '../textboxes/textboxes.module';
1314
import { tooltipAppRoutes } from '../tooltip/tooltip.module';
1415
export let samplesList: any = [
@@ -18,6 +19,9 @@ export let samplesList: any = [
1819
{
1920
'name': 'CircularGauge', 'category': 'Datavisualization', 'order': '01', 'path': 'circulargauge', 'samples': circulargaugeAppRoutes, "type": "new"
2021
},
22+
{
23+
'name': 'LinearGauge', 'category': 'Datavisualization', 'order': '01', 'path': 'lineargauge', 'samples': lineargaugeAppRoutes, "type": "new"
24+
},
2125
{
2226
'name': 'Grid', 'category': 'Grids', 'order': '02', 'path': 'grid', 'samples': gridRouteConfig, 'type': 'update'
2327
},

src/common/sb.router.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ import { DialogSampleModule } from '../dialog/dialog.module';
1313
import { TextboxesModule } from '../textboxes/textboxes.module';
1414
import { TooltipSampleModule } from '../tooltip/tooltip.module';
1515
import { CircularGaugeSampleModule } from '../circulargauge/circulargauge.module';
16+
import { LinearGaugeSampleModule } from '../lineargauge/lineargauge.module';
1617

1718
const appRoutes: any = [
1819
{ path: 'chart', loadChildren: ChartSampleModule },
1920
{ path: 'circulargauge', loadChildren: CircularGaugeSampleModule },
21+
{ path: 'lineargauge', loadChildren: LinearGaugeSampleModule },
2022
{ path: 'grid', loadChildren: GridSampleModule },
2123
{ path: 'form-validator', loadChildren: FormValidatorModule },
2224
{ path: 'Button', loadChildren: ButtonModule },
@@ -35,6 +37,7 @@ const appRoutes: any = [
3537
imports: [
3638
ChartSampleModule,
3739
CircularGaugeSampleModule,
40+
LinearGaugeSampleModule,
3841
GridSampleModule,
3942
FormValidatorModule,
4043
ButtonModule,

src/lineargauge/annotation-plnkr.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"app.module":"import { AnnotationComponent } from './annotation.component';\nimport { HttpModule, JsonpModule } from '@angular/http';\nimport { BrowserModule } from '@angular/platform-browser';\nimport 'rxjs/add/operator/map';\n/**\n * Lineargauge Control\n */\nimport { NgModule, ModuleWithProviders, Type } from '@angular/core';\n\nimport { LinearGaugeAllModule } from '@syncfusion/ej2-ng-lineargauge';\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n@NgModule({\n imports: [LinearGaugeAllModule, HttpModule, JsonpModule, BrowserModule],\ndeclarations: [AnnotationComponent],\nbootstrap: [AnnotationComponent]\n})\nexport class AppModule { }","annotation.component":"import { Component, ViewEncapsulation } from '@angular/core';\n\n/**\n * Annotation linear gauge\n */\n@Component({\n selector: 'control-content',\n templateUrl: 'annotation.html',\n encapsulation: ViewEncapsulation.None\n})\nexport class AnnotationComponent {\n public Palette: String[] = ['#30b32d', '#ffdd00', '#f03e3e'];\n\n public Axes: Object[] = [{\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 public Annotation: Object[] = [\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/angular/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/angular/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/angular/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 ;\n}","annotation.html":"<script id='tool' type=\"text/x-template\">\n <div id='templateWrap'>\n <img src='http://npmci.syncfusion.com/production/angular/demos/src/lineargauge/images/charging.png'>\n <div class='des'>\n <span>Energy &nbsp;&nbsp;:&nbsp; 60%</span>\n </div>\n </div>\n</script>\n<style>\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 #targetContainer .text-center {\n color: rgba(0, 0, 0, 0.54);\n }\n</style>\n<div class=\"control-section\">\n <ej-lineargauge id='annotationContainer' style='display:block;' orientation='Horizontal' [rangePalettes]='Palette' [axes]='Axes'\n [annotations]='Annotation'>\n </ej-lineargauge>\n</div>\n<style>\n .control-section {\n min-height: 450px;\n }\n</style>","index.html":"<html>\n \n <head>\n <meta name=\"author\" content=\"Syncfusion\" />\n <link href=\"http://npmci.syncfusion.com/packages/production/material.css\" rel=\"stylesheet\" />\n <script src=\"https://unpkg.com/core-js/client/shim.min.js\"></script>\n <script src=\"https://cdnjs.cloudflare.com/ajax/libs/core-js/2.4.1/core.min.js\"></script>\n <script src=\"https://cdnjs.cloudflare.com/ajax/libs/zone.js/0.6.25/zone.min.js\"></script>\n <script src=\"https://unpkg.com/[email protected]\"></script>\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 \n <body>\n <control-content>\n <div id='loader'>Loading...</div>\n </control-content>\n </body>\n \n </html>\n ","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 \"angular:\": \"https://unpkg.com/@angular/\"\n },\n map: {\n main: 'main.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 \"@syncfusion/ej2-lineargauge\": \"syncfusion:ej2-lineargauge/dist/ej2-lineargauge.umd.min.js\",\n\n \"@syncfusion/ej2-ng-base\": \"syncfusion:ej2-ng-base/dist/ej2-ng-base.umd.min.js\",\n \"@syncfusion/ej2-ng-buttons\": \"syncfusion:ej2-ng-buttons/dist/ej2-ng-buttons.umd.min.js\",\n \"@syncfusion/ej2-ng-calendars\": \"syncfusion:ej2-ng-calendars/dist/ej2-ng-calendars.umd.min.js\",\n \"@syncfusion/ej2-ng-charts\": \"syncfusion:ej2-ng-charts/dist/ej2-ng-charts.umd.min.js\",\n \"@syncfusion/ej2-ng-circulargauge\": \"syncfusion:ej2-ng-circulargauge/dist/ej2-ng-circulargauge.umd.min.js\",\n \"@syncfusion/ej2-ng-data\": \"syncfusion:ej2-ng-data/dist/ej2-ng-data.umd.min.js\",\n \"@syncfusion/ej2-ng-dropdowns\": \"syncfusion:ej2-ng-dropdowns/dist/ej2-ng-dropdowns.umd.min.js\",\n \"@syncfusion/ej2-ng-grids\": \"syncfusion:ej2-ng-grids/dist/ej2-ng-grids.umd.min.js\",\n \"@syncfusion/ej2-ng-inputs\": \"syncfusion:ej2-ng-inputs/dist/ej2-ng-inputs.umd.min.js\",\n \"@syncfusion/ej2-ng-lists\": \"syncfusion:ej2-ng-lists/dist/ej2-ng-lists.umd.min.js\",\n \"@syncfusion/ej2-ng-navigations\": \"syncfusion:ej2-ng-navigations/dist/ej2-ng-navigations.umd.min.js\",\n \"@syncfusion/ej2-ng-popups\": \"syncfusion:ej2-ng-popups/dist/ej2-ng-popups.umd.min.js\",\n \"@syncfusion/ej2-ng-lineargauge\": \"syncfusion:ej2-ng-lineargauge/dist/ej2-ng-lineargauge.umd.min.js\",\n\n '@angular/core': 'angular:core/bundles/core.umd.js',\n '@angular/common': 'angular:common/bundles/common.umd.js',\n '@angular/compiler': 'angular:compiler/bundles/compiler.umd.js',\n '@angular/http': 'angular:http/bundles/http.umd.js',\n '@angular/forms': 'angular:forms/bundles/forms.umd.js',\n '@angular/router': 'angular:router/bundles/router.umd.js',\n '@angular/platform-browser': 'angular:platform-browser/bundles/platform-browser.umd.js',\n '@angular/platform-browser-dynamic': 'angular:platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',\n '@angular/material': 'angular:material/bundles/material.umd.js',\n 'rxjs': 'https://unpkg.com/rxjs'\n },\n meta: { \n '*.json': { loader: 'plugin-json' }\n }\n});\n\nSystem.import('main.ts').catch(console.error.bind(console));\n","main.ts":"import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';\nimport { enableProdMode } from '@angular/core';\nimport { AppModule } from './app.module';\n\nenableProdMode();\nplatformBrowserDynamic().bootstrapModule(AppModule);"}
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
import { Component, ViewEncapsulation } from '@angular/core';
2+
3+
/**
4+
* Annotation linear gauge
5+
*/
6+
@Component({
7+
selector: 'control-content',
8+
templateUrl: 'annotation.html',
9+
encapsulation: ViewEncapsulation.None
10+
})
11+
export class AnnotationComponent {
12+
public Palette: String[] = ['#30b32d', '#ffdd00', '#f03e3e'];
13+
14+
public Axes: Object[] = [{
15+
maximum: 90,
16+
labelStyle: {
17+
font: {
18+
size: '0px'
19+
}
20+
},
21+
line: {
22+
width: 0
23+
},
24+
pointers: [
25+
{
26+
value: 35,
27+
height: 15,
28+
width: 15,
29+
color: '#757575',
30+
placement: 'Near',
31+
markerType: 'Triangle',
32+
offset: -50
33+
}
34+
],
35+
majorTicks: {
36+
interval: 10,
37+
height: 0
38+
},
39+
minorTicks: {
40+
height: 0
41+
},
42+
ranges: [{
43+
start: 0,
44+
end: 30,
45+
startWidth: 50,
46+
endWidth: 50
47+
},
48+
{
49+
start: 30,
50+
end: 60,
51+
startWidth: 50,
52+
endWidth: 50
53+
},
54+
{
55+
start: 60,
56+
end: 90,
57+
startWidth: 50,
58+
endWidth: 50
59+
}]
60+
}];
61+
public Annotation: Object[] = [
62+
{
63+
content: '<div id="title" style="width:200px;"><p style="font-size:18px;">CPU Utilization</p></div>',
64+
horizontalAlignment: 'Center',
65+
x: 35,
66+
y: 50
67+
},
68+
{
69+
content: '<div id="low"><img style="height:25px;width:25px;" src="src/lineargauge/images/Low.png"/></div>',
70+
axisIndex: 0,
71+
axisValue: 15,
72+
y: -25,
73+
zIndex: '1'
74+
},
75+
{
76+
content: '<div id="moderate"><img style="height:25px;width:25px;" src="src/lineargauge/images/Moderate.png"/></div>',
77+
axisIndex: 0,
78+
axisValue: 45,
79+
y: -25,
80+
zIndex: '1'
81+
},
82+
{
83+
content: '<div id="high"><img style="height:25px;width:25px;" src="src/lineargauge/images/High.png"/></div>',
84+
axisIndex: 0,
85+
axisValue: 75,
86+
y: -25,
87+
zIndex: '1'
88+
},
89+
{
90+
content: '<div id="lowText"><p style="font-size:15px;color:#248622;">Low</p></div>',
91+
axisIndex: 0,
92+
axisValue: 15,
93+
y: 20
94+
},
95+
{
96+
content: '<div id="moderateText"><p style="font-size:15px;color:#ba9e2a;">Moderate</p></div>',
97+
axisIndex: 0,
98+
axisValue: 45,
99+
y: 20
100+
},
101+
{
102+
content: '<div id="highText"><p style="font-size:15px;color:#b42f2f;">High</p></div>',
103+
axisIndex: 0,
104+
axisValue: 75,
105+
y: 20
106+
}
107+
];
108+
constructor() {
109+
//code
110+
};
111+
}

src/lineargauge/annotation.html

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<script id='tool' type="text/x-template">
2+
<div id='templateWrap'>
3+
<img src='src/lineargauge/images/charging.png'>
4+
<div class='des'>
5+
<span>Energy &nbsp;&nbsp;:&nbsp; 60%</span>
6+
</div>
7+
</div>
8+
</script>
9+
<style>
10+
#templateWrap img {
11+
border-radius: 30px;
12+
width: 30px;
13+
height: 30px;
14+
margin: 0 auto;
15+
}
16+
17+
#templateWrap .des {
18+
float: right;
19+
padding-left: 10px;
20+
line-height: 30px;
21+
}
22+
23+
#targetContainer .text-center {
24+
color: rgba(0, 0, 0, 0.54);
25+
}
26+
</style>
27+
<div class="control-section">
28+
<ej-lineargauge id='annotationContainer' style='display:block;' orientation='Horizontal' [rangePalettes]='Palette' [axes]='Axes'
29+
[annotations]='Annotation'>
30+
</ej-lineargauge>
31+
</div>
32+
<div id="description">
33+
<p>
34+
In this sample we have used annotations to indicate low, moderate and high ranges. Annotations are used to place the texts,
35+
shapes or images anywhere in the gauge. You can use <code>content</code>, <code>x</code>, <code>y</code>,
36+
<code>zIndex</code> properties to customize the annotations. And you can specify the id of the element that needs
37+
to be displayed, in the content property.
38+
</p>
39+
<br>
40+
<p style="font-weight: 500">Injecting Module</p>
41+
<p>Linear gauge component features are segregated into individual feature-wise modules. To render annotation, we need to
42+
inject
43+
<code>AnnotationsService</code> into the <code>@NgModule.providers</code> section.
44+
</p>
45+
</div>
46+
<style>
47+
.control-section {
48+
min-height: 450px;
49+
}
50+
</style>

src/lineargauge/axes-plnkr.json

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

0 commit comments

Comments
 (0)