fixed date issue for new desktop build
This commit is contained in:
Родитель
35c0ea8ac7
Коммит
5e27d26694
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "powerbi-visuals-linedotchart",
|
||||
"description": "LineDot Chart",
|
||||
"version": "0.3.4",
|
||||
"version": "0.3.5",
|
||||
"author": {
|
||||
"name": "Microsoft",
|
||||
"email": "pbicvsupport@microsoft.com"
|
||||
|
@ -46,6 +46,7 @@
|
|||
"powerbi-visuals-utils-testutils": "0.2.2",
|
||||
"powerbi-visuals-utils-tooltiputils": "0.3.0",
|
||||
"tslint": "3.15.1",
|
||||
"typings": "1.4.0"
|
||||
"typings": "1.4.0",
|
||||
"typescript": "2.1.4"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"displayName": "LineDot Chart",
|
||||
"guid": "LineDotChart1460463831201",
|
||||
"visualClassName": "LineDotChart",
|
||||
"version": "0.3.4",
|
||||
"version": "0.3.5",
|
||||
"description": "The LineDot chart is an animated line chart with fun animated dots. Use the LineDot chart to engage your audience especially in a presentation context. The bubbles size can be dynamic based on data you provide. A counter is provided that you can use to show a running value as the chart animates. Format options are provided for Lines, Dots, and Animation.",
|
||||
"supportUrl": "http://community.powerbi.com",
|
||||
"gitHubUrl": "https://github.com/Microsoft/powerbi-visuals-linedotchart"
|
||||
|
|
|
@ -57,8 +57,21 @@ module powerbi.extensibility.visual {
|
|||
let values: DataViewValueColumns = categorical && categorical.values || <DataViewValueColumns>[];
|
||||
let series: any = categorical && values.source && this.getSeriesValues(dataView);
|
||||
return categorical && _.mapValues(new this<any[]>(), (n, i) =>
|
||||
(<DataViewCategoricalColumn[]>_.toArray(categories)).concat(_.toArray(values))
|
||||
.filter(x => x.source.roles && x.source.roles[i]).map(x => x.values)[0]
|
||||
(<DataViewCategoricalColumn[]>_
|
||||
.toArray(categories))
|
||||
.concat(_.toArray(values))
|
||||
.filter(x => x.source.roles && x.source.roles[i])
|
||||
.map(x => x.values.map(y => {
|
||||
if (_.isString(y)) {
|
||||
let date: Date = new Date(y);
|
||||
if (isNaN(date.getTime())) {
|
||||
return y;
|
||||
}
|
||||
|
||||
return date;
|
||||
}
|
||||
return y;
|
||||
}))[0]
|
||||
|| values.source && values.source.roles && values.source.roles[i] && series);
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,13 @@ module powerbi.extensibility.visual.test {
|
|||
new Date(2016, 3, 1, 2, 43, 3));
|
||||
public valuesValue = helpers.getRandomNumbers(this.valuesDate.length, 0, 5361);
|
||||
|
||||
public valuesDateAsString: string[] = this.valuesDate.map(x => x.toISOString());
|
||||
|
||||
public getDataView(columnNames?: string[]): powerbi.DataView {
|
||||
return this.createDataView(false, columnNames);
|
||||
}
|
||||
|
||||
private createDataView(isDateAsString: boolean, columnNames?: string[]): powerbi.DataView {
|
||||
return this.createCategoricalDataViewBuilder([
|
||||
{
|
||||
source: {
|
||||
|
@ -71,7 +77,7 @@ module powerbi.extensibility.visual.test {
|
|||
type: ValueType.fromDescriptor({ dateTime: true }),
|
||||
roles: { Date: true }
|
||||
},
|
||||
values: this.valuesDate
|
||||
values: isDateAsString ? this.valuesDateAsString : this.valuesDate
|
||||
}
|
||||
], [
|
||||
{
|
||||
|
@ -84,5 +90,9 @@ module powerbi.extensibility.visual.test {
|
|||
}
|
||||
], columnNames).build();
|
||||
}
|
||||
|
||||
public getDataViewForCategoricalValues(columnNames?: string[]): powerbi.DataView {
|
||||
return this.createDataView(true, columnNames);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,11 +44,13 @@ namespace powerbi.extensibility.visual.test {
|
|||
import ColumnNames = powerbi.extensibility.visual.LineDotChart1460463831201.ColumnNames;
|
||||
import LineDotPoint = powerbi.extensibility.visual.LineDotChart1460463831201.LineDotPoint;
|
||||
import LineDotChartViewModel = powerbi.extensibility.visual.LineDotChart1460463831201.LineDotChartViewModel;
|
||||
import LineDotChartColumns = powerbi.extensibility.visual.LineDotChart1460463831201.LineDotChartColumns;
|
||||
|
||||
describe("LineDotChartTests", () => {
|
||||
let visualBuilder: LineDotChartBuilder,
|
||||
defaultDataViewBuilder: LineDotChartData,
|
||||
dataView: DataView;
|
||||
dataView: DataView,
|
||||
dataViewForCategoricalColumn: DataView;
|
||||
|
||||
beforeEach(() => {
|
||||
visualBuilder = new LineDotChartBuilder(1000, 500);
|
||||
|
@ -205,5 +207,17 @@ namespace powerbi.extensibility.visual.test {
|
|||
expect(actualResult[1].value).toMatch(defaultFormattedValue);
|
||||
});
|
||||
});
|
||||
|
||||
describe("getCategoricalValues", () => {
|
||||
beforeEach(() => {
|
||||
dataViewForCategoricalColumn = defaultDataViewBuilder.getDataViewForCategoricalValues();
|
||||
});
|
||||
|
||||
it("date values provided as string should be converted to Date type", () => {
|
||||
const categoricalValues: LineDotChartColumns<any[]> = LineDotChartColumns.getCategoricalValues(dataViewForCategoricalColumn);
|
||||
|
||||
expect(_.isDate(categoricalValues.Date[0])).toBeTruthy();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче