Skip to content
This repository was archived by the owner on Jul 22, 2022. It is now read-only.

Commit

Permalink
start adapting to lineup
Browse files Browse the repository at this point in the history
  • Loading branch information
sgratzl committed Jan 26, 2018
1 parent aa5c485 commit 49f3c00
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 78 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/node_modules
.tmp
5 changes: 3 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"editor.tabSize": 4,
"editor.tabSize": 2,
"editor.insertSpaces": true,
"files.eol": "\n",
"files.watcherExclude": {
Expand Down Expand Up @@ -33,5 +33,6 @@
],
"url": "./.api/v1.10.0/schema.dependencies.json"
}
]
],
"files.trimTrailingWhitespace": true
}
35 changes: 15 additions & 20 deletions capabilities.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,27 +58,22 @@
}
}
},
"supportsHighlight": true,
"advancedEditModeSupport": 2,
"sorting": {
"custom": {
}
},
"dataViewMappings": [
{
"categorical": {
"categories": {
"for": {
"in": "category"
},
"dataReductionAlgorithm": {
"top": {}
}
},
"values": {
"select": [
{
"bind": {
"to": "measure"
}
}
]
}
}
{
"table": {
"rows": {
"select": [
{ "for": { "in": "category" } },
{ "for": { "in": "measure" } }
]
}
}
}
]
}
3 changes: 3 additions & 0 deletions dependencies.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{

}
11 changes: 6 additions & 5 deletions pbiviz.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,25 @@
"name": "lineup_powerbi",
"displayName": "lineup_powerbi",
"guid": "lineuppowerbiE314DAA0C5D64CB288D237BF5C4CA3CD",
"visualClassName": "Visual",
"visualClassName": "LineUpVisual",
"version": "1.0.0",
"description": "",
"supportUrl": "",
"gitHubUrl": ""
},
"apiVersion": "1.10.0",
"author": {
"name": "",
"email": ""
"name": "Samuel Gratzl",
"email": "[email protected]"
},
"assets": {
"icon": "assets/icon.png"
},
"externalJS": [
"node_modules/powerbi-visuals-utils-dataviewutils/lib/index.js"
"node_modules/powerbi-visuals-utils-dataviewutils/lib/index.js",
"node_modules/lineupjs/build/LineUpJS.min.js"
],
"style": "style/visual.less",
"style": "style/style.less",
"capabilities": "capabilities.json",
"dependencies": "dependencies.json",
"stringResources": []
Expand Down
34 changes: 17 additions & 17 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,24 @@
*/

module powerbi.extensibility.visual {
"use strict";
import DataViewObjectsParser = powerbi.extensibility.utils.dataview.DataViewObjectsParser;
"use strict";
import DataViewObjectsParser = powerbi.extensibility.utils.dataview.DataViewObjectsParser;

export class VisualSettings extends DataViewObjectsParser {
public dataPoint: dataPointSettings = new dataPointSettings();
}
export class LineUpVisualSettings extends DataViewObjectsParser {
readonly dataPoint = new DataPointSettings();
}

export class dataPointSettings {
// Default color
public defaultColor: string = "";
// Show all
public showAllDataPoints: boolean = true;
// Fill
public fill: string = "";
// Color saturation
public fillRule: string = "";
// Text Size
public fontSize: number = 12;
}
export class DataPointSettings {
// Default color
defaultColor = "";
// Show all
showAllDataPoints = true;
// Fill
fill = "";
// Color saturation
fillRule = "";
// Text Size
fontSize = 12;
}

}
46 changes: 21 additions & 25 deletions src/visual.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,46 +26,42 @@

module powerbi.extensibility.visual {
"use strict";
export class Visual implements IVisual {
private target: HTMLElement;
export class LineUpVisual implements IVisual {
private readonly target: HTMLElement;
private readonly colorPalette: IColorPalette;

private updateCount: number;
private settings: VisualSettings;
private textNode: Text;
private settings: LineUpVisualSettings;

constructor(options: VisualConstructorOptions) {
console.log('Visual constructor', options);
this.colorPalette = options.host.colorPalette;
this.target = options.element;
this.updateCount = 0;
if (typeof document !== "undefined") {
const new_p: HTMLElement = document.createElement("p");
new_p.appendChild(document.createTextNode("Update count:"));
const new_em: HTMLElement = document.createElement("em");
this.textNode = document.createTextNode(this.updateCount.toString());
new_em.appendChild(this.textNode);
new_p.appendChild(new_em);
this.target.appendChild(new_p);
}
}

public update(options: VisualUpdateOptions) {
this.settings = Visual.parseSettings(options && options.dataViews && options.dataViews[0]);
update(options: VisualUpdateOptions) {
this.settings = LineUpVisual.parseSettings(options && options.dataViews && options.dataViews[0]);
console.log('Visual update', options);
if (typeof this.textNode !== "undefined") {
this.textNode.textContent = (this.updateCount++).toString();
}
this.target.innerHTML = `<p>Update count: <em>${(this.updateCount++)}</em></p>`;
}

private static parseSettings(dataView: DataView): LineUpVisualSettings {
return <LineUpVisualSettings>LineUpVisualSettings.parse(dataView);
}

private static parseSettings(dataView: DataView): VisualSettings {
return VisualSettings.parse(dataView) as VisualSettings;
destroy() {
// TODO
}

/**
* This function gets called for each of the objects defined in the capabilities files and allows you to select which of the

/**
* This function gets called for each of the objects defined in the capabilities files and allows you to select which of the
* objects and properties you want to expose to the users in the property pane.
*
*
*/
public enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstance[] | VisualObjectInstanceEnumerationObject {
return VisualSettings.enumerateObjectInstances(this.settings || VisualSettings.getDefault(), options);
enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstance[] | VisualObjectInstanceEnumerationObject {
return LineUpVisualSettings.enumerateObjectInstances(this.settings || LineUpVisualSettings.getDefault(), options);
}
}
}
3 changes: 3 additions & 0 deletions style/style.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@


@import (less) "node_modules/lineupjs/build/LineUpJS.min.css";
9 changes: 0 additions & 9 deletions style/visual.less

This file was deleted.

0 comments on commit 49f3c00

Please sign in to comment.