Skip to content

Commit 7ab9844

Browse files
committed
add web version of test code-gen-library items for testing
1 parent 6895ffb commit 7ab9844

File tree

41 files changed

+1085
-0
lines changed
  • code-gen-library
    • FormatDateLabelAsDateAndTime
    • FormatDateLabelAsDate
    • FormatDateLabelAsShortDate
    • FormatDateLabelAsTime
    • FormatLabelAsTest
    • TestsAddDataLegendHeaderFormatSpecfierLongWeekday
    • TestsAddDataLegendHeaderFormatSpecfierTimeShort
    • TestsAddDataLegendHeaderSimpleFormatSpecfierShort
    • TestsAddDataLegendHeaderSimpleFormatSpecfier
    • TestsAddDataLegendValueFormatSpecifier
    • TestsAddDataPieNumberFormatter
    • TestsAddNameTooltip
    • TestsAssignStyleToNegativeShapes2
    • TestsAssignStyleToNegativeShapes
    • TestsAssignStyleToSelectedMarkers
    • TestsDataLegendCalcSummaryAdd100WDetails
    • TestsDataLegendCalcSummaryAdd100
    • TestsDataLegendHideBadgeOnSeriesTwo
    • TestsDataLegendHideRowOnSeriesTwo
    • TestsDataLegendStyleGroupRow1
    • TestsDataLegendStyleHeaderRed
    • TestsDataLegendStyleHeaderWithCurrent
    • TestsDataLegendStyleSeriesColumns1
    • TestsDataLegendStyleSeriesColumns2
    • TestsDataLegendStyleSeriesColumnsByGroup1
    • TestsDataLegendStyleSeriesRows1
    • TestsDataLegendStyleSeriesRows2
    • TestsDataLegendStyleSeriesRowsByGroup1
    • TestsDataLegendStyleSummaryColumns1
    • TestsDataLegendStyleSummaryColumns3
    • TestsDataLegendStyleSummaryColumnsByGroup1
    • TestsDataLegendStyleSummaryRows1
    • TestsDataLegendStyleSummaryRows2
    • TestsDataLegendStyleSummaryRows3
    • TestsDataLegendStyleSummaryRowsByGroup1
    • TestsDataLegendStyleSummaryRowsByGroup2
    • TestsSetValueOverlayAxisAnnotationToTEST
    • TestsUpdateBadgeModeInSeriesAddedEvent
    • TestsUpdateGroupsInSeriesAddedEvent
    • TestsUpdateTitlesInSeriesAddedEvent
    • TestsUpdateValueLayerPrecisionInSeriesAddedEvent

Some content is hidden

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

41 files changed

+1085
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
//begin imports
2+
3+
//end imports
4+
5+
export class FormatDateLabelAsDate
6+
{
7+
//begin eventHandler
8+
//WPF: Infragistics.Controls.Charts.AxisFormatLabelEventHandler
9+
public formatDateLabelAsDate(sender: any, item: any): string
10+
{
11+
12+
let d: Date;
13+
14+
if (item instanceof Date) {
15+
d = item;
16+
} else if (typeof item === 'object' && item !== null && 'Date' in item) {
17+
d = new Date(item['Date']);
18+
} else {
19+
if (typeof item === 'number') {
20+
if (item >= Number.MIN_SAFE_INTEGER && item <= Number.MAX_SAFE_INTEGER) {
21+
d = new Date(item);
22+
} else {
23+
return item.toString();
24+
}
25+
} else if (typeof item === 'object' && item !== null) {
26+
const dateProp = item.constructor?.prototype?.Date || item['Date'];
27+
d = new Date(dateProp);
28+
} else {
29+
throw new Error("Unsupported item type");
30+
}
31+
}
32+
33+
const year = d.getFullYear();
34+
const month = String(d.getMonth() + 1).padStart(2, '0'); // Months are 0-based
35+
const day = String(d.getDate()).padStart(2, '0');
36+
37+
return `${year}-${month}-${day}`;
38+
39+
}
40+
//end eventHandler
41+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
//begin imports
2+
using System;
3+
using System.Collections;
4+
//end imports
5+
6+
export class FormatDateLabelAsDateAndTime
7+
{
8+
//begin eventHandler
9+
public formatDateLabelAsDateAndTime( sender:any, item:any):string
10+
{
11+
12+
let d: Date;
13+
14+
if (item instanceof Date) {
15+
d = item;
16+
} else if (typeof item === 'object' && item !== null && 'Date' in item) {
17+
d = new Date(item['Date']);
18+
} else {
19+
if (typeof item === 'number') {
20+
if (item >= Number.MIN_SAFE_INTEGER && item <= Number.MAX_SAFE_INTEGER) {
21+
d = new Date(item);
22+
} else {
23+
return item.toString();
24+
}
25+
} else if (typeof item === 'object' && item !== null) {
26+
const dateProp = item.constructor?.prototype?.Date || item['Date'];
27+
d = new Date(dateProp);
28+
} else {
29+
throw new Error("Unsupported item type");
30+
}
31+
}
32+
33+
const year = d.getFullYear();
34+
const month = String(d.getMonth() + 1).padStart(2, '0');
35+
const day = String(d.getDate()).padStart(2, '0');
36+
const hours = String(d.getHours()).padStart(2, '0');
37+
const minutes = String(d.getMinutes()).padStart(2, '0');
38+
const seconds = String(d.getSeconds()).padStart(2, '0');
39+
40+
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
41+
42+
}
43+
//end eventHandler
44+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
//begin imports
2+
//end imports
3+
4+
export class FormatDateLabelAsShortDate
5+
{
6+
//begin eventHandler
7+
//WPF: Infragistics.Controls.Charts.AxisFormatLabelEventHandler
8+
public FormatDateLabelAsShortDate(sender: any, item: any): string
9+
{
10+
11+
let d: Date;
12+
13+
if (item instanceof Date) {
14+
d = item;
15+
} else if (typeof item === 'object' && item !== null && 'Date' in item) {
16+
d = new Date(item['Date']);
17+
} else {
18+
if (typeof item === 'number') {
19+
if (item >= Number.MIN_SAFE_INTEGER && item <= Number.MAX_SAFE_INTEGER) {
20+
d = new Date(item);
21+
} else {
22+
return item.toString();
23+
}
24+
} else if (typeof item === 'object' && item !== null) {
25+
const dateProp = item.constructor?.prototype?.Date || item['Date'];
26+
d = new Date(dateProp);
27+
} else {
28+
throw new Error("Unsupported item type");
29+
}
30+
}
31+
32+
const month = String(d.getMonth() + 1).padStart(2, '0');
33+
const day = String(d.getDate()).padStart(2, '0');
34+
const year = String(d.getFullYear()).slice(-2); // Get last two digits
35+
36+
return `${month}/${day}/${year}`;
37+
38+
}
39+
//end eventHandler
40+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
//begin imports
2+
3+
//end imports
4+
5+
export class FormatDateLabelAsTime
6+
{
7+
//begin eventHandler
8+
//WPF: Infragistics.Controls.Charts.AxisFormatLabelEventHandler
9+
public formatDateLabelAsTime(sender: any, item: any): string
10+
{
11+
12+
let d: Date;
13+
14+
if (item instanceof Date) {
15+
d = item;
16+
} else if (typeof item === 'object' && item !== null && 'Date' in item) {
17+
d = new Date(item['Date']);
18+
} else {
19+
if (typeof item === 'number') {
20+
if (item >= Number.MIN_SAFE_INTEGER && item <= Number.MAX_SAFE_INTEGER) {
21+
d = new Date(item);
22+
} else {
23+
return item.toString();
24+
}
25+
} else if (typeof item === 'object' && item !== null) {
26+
const dateProp = item.constructor?.prototype?.Date || item['Date'];
27+
d = new Date(dateProp);
28+
} else {
29+
throw new Error("Unsupported item type");
30+
}
31+
}
32+
33+
return d.toTimeString().split(' ')[0]; // "HH:mm:ss"
34+
}
35+
//end eventHandler
36+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//begin imports
2+
//end imports
3+
4+
export class FormatLabelAsTest
5+
{
6+
//begin eventHandler
7+
//WPF: Infragistics.Controls.Charts.AxisFormatLabelEventHandler
8+
public formatLabelAsTest(sender:any,item: any): string
9+
{
10+
return "TEST";
11+
}
12+
//end eventHandler
13+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//begin imports
2+
import { IgcDataLegendComponent } from 'igniteui-webcomponents-charts';
3+
import { DateTimeFormatSpecifier } from 'igniteui-webcomponents-core';
4+
//end imports
5+
6+
export class TestsAddDataLegendHeaderFormatSpecfierLongWeekday
7+
{
8+
9+
//begin eventHandler
10+
public testsAddDataLegendHeaderFormatSpecfierLongWeekday(): void{
11+
// TODO: lond weekday cannot currently be set in WPF
12+
13+
var legend = CodeGenHelper.getDescription<IgcDataLegendComponent>("secondary");
14+
var specifiers: any[];
15+
const spec: DateTimeFormatSpecifier = new DateTimeFormatSpecifier();
16+
spec.locale = "en-US";
17+
spec.dateStyle = "short";
18+
specifiers.push(spec);
19+
legend.headerFormatSpecifiers = specifiers;
20+
21+
}
22+
//end eventHandler
23+
24+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//begin imports
2+
import { IgcDataLegendComponent } from 'igniteui-webcomponents-charts';
3+
import { DateTimeFormatSpecifier } from 'igniteui-webcomponents-core';
4+
5+
//end imports
6+
7+
export class TestsAddDataLegendHeaderFormatSpecfierTimeShort
8+
{
9+
10+
//begin eventHandler
11+
public testsAddDataLegendHeaderFormatSpecfierTimeShort(){
12+
var legend = CodeGenHelper.getDescription<IgcDataLegendComponent>("secondary");
13+
var specifiers: any[];
14+
const spec: DateTimeFormatSpecifier = new DateTimeFormatSpecifier();
15+
spec.locale = "en-US";
16+
spec.timeStyle = "short";
17+
specifiers.push(spec);
18+
legend.headerFormatSpecifiers = specifiers;
19+
}
20+
//end eventHandler
21+
22+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//begin imports
2+
import { IgcDataLegendComponent } from 'igniteui-webcomponents-charts';
3+
import { DateTimeFormatSpecifier } from 'igniteui-webcomponents-core';
4+
//end imports
5+
6+
export class TestsAddDataLegendHeaderSimpleFormatSpecfier
7+
{
8+
9+
//begin eventHandler
10+
public testsAddDataLegendHeaderSimpleFormatSpecfier(){
11+
var legend = CodeGenHelper.getDescription<IgcDataLegendComponent>("secondary");
12+
13+
var specifiers: any[];
14+
const spec: DateTimeFormatSpecifier = new DateTimeFormatSpecifier();
15+
spec.locale = "en-US";
16+
spec.dateStyle = "long";
17+
specifiers.push(spec);
18+
legend.headerFormatSpecifiers = specifiers;
19+
}
20+
//end eventHandler
21+
22+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//begin imports
2+
import { IgcDataLegendComponent } from 'igniteui-webcomponents-charts';
3+
import { DateTimeFormatSpecifier } from 'igniteui-webcomponents-core';
4+
//end imports
5+
6+
export class TestsAddDataLegendHeaderSimpleFormatSpecfierShort
7+
{
8+
9+
//begin eventHandler
10+
public testsAddDataLegendHeaderSimpleFormatSpecfierShort(){
11+
var legend = CodeGenHelper.getDescription<IgcDataLegendComponent>("secondary");
12+
var specifiers: any[];
13+
const spec: DateTimeFormatSpecifier = new DateTimeFormatSpecifier();
14+
spec.locale = "en-US";
15+
spec.dateStyle = "short";
16+
specifiers.push(spec);
17+
legend.headerFormatSpecifiers = specifiers;
18+
}
19+
//end eventHandler
20+
21+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
//begin imports
2+
import { IgcDataLegendComponent } from 'igniteui-webcomponents-charts';
3+
import { NumberFormatSpecifier } from 'igniteui-webcomponents-core';
4+
//end imports
5+
6+
export class TestsAddDataLegendValueFormatSpecifier
7+
{
8+
9+
//begin eventHandler
10+
public testsAddDataLegendValueFormatSpecifier(){
11+
var legend = CodeGenHelper.getDescription<IgcDataLegendComponent>("secondary");
12+
const formatterInfo = CodeGenHelper.findByName<any>("DataLegendValueFormatSpecifier");
13+
var numSpec = new NumberFormatSpecifier();
14+
var specifiers: any[];
15+
for (const prop in formatterInfo) {
16+
switch (prop) {
17+
case "MaximumFractionDigits":
18+
numSpec.maximumFractionDigits = parseInt(formatterInfo[prop]);
19+
break;
20+
case "MinimumFractionDigits":
21+
numSpec.minimumFractionDigits = parseInt(formatterInfo[prop]);
22+
break;
23+
case "MinimumIntegerDigits":
24+
numSpec.minimumIntegerDigits = parseInt(formatterInfo[prop]);
25+
break;
26+
case "Locale":
27+
numSpec.locale = formatterInfo[prop];
28+
break;
29+
case "UseGrouping":
30+
numSpec.useGrouping = Boolean(formatterInfo[prop]);
31+
break;
32+
case "Style":
33+
numSpec.style = formatterInfo[prop];
34+
break;
35+
36+
}
37+
}
38+
specifiers.push(numSpec);
39+
legend.valueFormatSpecifiers = specifiers;
40+
}
41+
//end eventHandler
42+
43+
}

0 commit comments

Comments
 (0)