Skip to content

Commit

Permalink
Merge pull request #43 from jku-vds-lab/jakob/prototype-presentation-…
Browse files Browse the repository at this point in the history
…2402

Parameterized zoom settings
  • Loading branch information
VAISHALI-DHANOA authored Mar 1, 2022
2 parents 30f8fcc + 0aeaec7 commit acb31fb
Show file tree
Hide file tree
Showing 12 changed files with 189 additions and 101 deletions.
Binary file modified assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icon_old.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
115 changes: 65 additions & 50 deletions capabilities.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
]
},
{
"displayName": "Slab length",
"displayName": "Overlay Length",
"name": "slabX",
"kind": "GroupingOrMeasure",
"preferredTypes": [
Expand All @@ -40,7 +40,7 @@
]
},
{
"displayName": "Slab width",
"displayName": "Overlay Width",
"name": "slabY",
"kind": "GroupingOrMeasure",
"preferredTypes": [
Expand Down Expand Up @@ -124,11 +124,62 @@
}
],
"objects": {
"axisSettings": {
"displayName": "Axis Settings",
"properties": {
"xAxis": {
"displayName": "X-Axis",
"type": {
"enumeration": [
{
"displayName": "None",
"value": "None"
},
{
"displayName": "Labels",
"value": "Labels"
},
{
"displayName": "Ticks",
"value": "Ticks"
},
{
"displayName": "Ticks and Labels",
"value": "TicksLabels"
}
]
}
},
"yAxis": {
"displayName": "Y-Axis",
"type": {
"enumeration": [
{
"displayName": "None",
"value": "None"
},
{
"displayName": "Labels",
"value": "Labels"
},
{
"displayName": "Ticks",
"value": "Ticks"
},
{
"displayName": "Ticks and Labels",
"value": "TicksLabels"
}
]
}
}
}
},
"colorSettings": {
"displayName": "Color Settings",
"properties": {
"verticalRulerColor": {
"displayName": "Vertical ruler color",
"displayName": "Vertical Ruler Color",
"description": "The stroke color of the vertical ruler.",
"type": {
"fill": {
Expand All @@ -139,8 +190,8 @@
}
},
"slabColor": {
"displayName": "Slab color",
"description": "The stroke color of the slab lines.",
"displayName": "Plot Overlay Color",
"description": "The stroke color of the plot overlay lines.",
"type": {
"fill": {
"solid": {
Expand Down Expand Up @@ -182,7 +233,7 @@
}
},
"overlayPlotSettings": {
"displayName": "Overlay Plot Settings",
"displayName": "Plot Overlay Settings",
"properties": {
"slabType": {
"displayName": "Choose Type",
Expand Down Expand Up @@ -254,53 +305,17 @@
}
}
},
"axisSettings": {
"displayName": "Axis Settings",
"zoomingSettings": {
"displayName": "Zooming Settings",
"properties": {
"xAxis": {
"displayName": "X-Axis",
"type": {
"enumeration": [
{
"displayName": "None",
"value": "None"
},
{
"displayName": "Labels",
"value": "Labels"
},
{
"displayName": "Ticks",
"value": "Ticks"
},
{
"displayName": "Ticks and Labels",
"value": "TicksLabels"
}
]
}
"show": {
"displayName": "Enable Zooming",
"type": {"bool": true}
},
"yAxis": {
"displayName": "Y-Axis",
"maximum": {
"displayName": "Maximum Zoom Factor",
"type": {
"enumeration": [
{
"displayName": "None",
"value": "None"
},
{
"displayName": "Labels",
"value": "Labels"
},
{
"displayName": "Ticks",
"value": "Ticks"
},
{
"displayName": "Ticks and Labels",
"value": "TicksLabels"
}
]
"numeric": true
}
}
}
Expand Down
29 changes: 29 additions & 0 deletions dist/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"version": "1.0.1",
"author": {
"name": "Jakob Zethofer",
"email": "[email protected]"
},
"resources": [
{
"resourceId": "rId0",
"sourceType": 5,
"file": "resources/slabprojection3A8101158FC14988B45B304F265A2202.pbiviz.json"
}
],
"visual": {
"name": "slabprojection",
"displayName": "Defect Projection on Slab",
"guid": "slabprojection3A8101158FC14988B45B304F265A2202",
"visualClassName": "Visual",
"version": "1.0.1",
"description": "Custom Visual for displaying multiple stacked charts for defect projection on slab",
"supportUrl": "https://github.com/jku-vds-lab/pro2future-voest-multiple-stacked-charts",
"gitHubUrl": "https://github.com/jku-vds-lab/pro2future-voest-multiple-stacked-charts"
},
"metadata": {
"pbivizjson": {
"resourceId": "rId0"
}
}
}
Binary file not shown.
Binary file not shown.
12 changes: 6 additions & 6 deletions pbiviz.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"visual": {
"name": "slabprojection",
"displayName": "slab_projection",
"displayName": "Defect Projection on Slab",
"guid": "slabprojection3A8101158FC14988B45B304F265A2202",
"visualClassName": "Visual",
"version": "1.0.0",
"description": "",
"supportUrl": "",
"gitHubUrl": ""
"description": "Custom Visual for displaying multiple stacked charts for defect projection on slab",
"supportUrl": "https://github.com/jku-vds-lab/pro2future-voest-multiple-stacked-charts",
"gitHubUrl": "https://github.com/jku-vds-lab/pro2future-voest-multiple-stacked-charts"
},
"apiVersion": "3.8.0",
"author": {
"name": "",
"email": ""
"name": "Jakob Zethofer",
"email": "[email protected]"
},
"assets": {
"icon": "assets/icon.png"
Expand Down
7 changes: 6 additions & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ export enum Settings {
overlayPlotSettings = "overlayPlotSettings",
plotTitleSettings = "plotTitleSettings",
tooltipTitleSettings = "tooltipTitleSettings",
yRangeSettings = "yRangeSettings"
yRangeSettings = "yRangeSettings",
zoomingSettings = "zoomingSettings"
}
export enum YRangeSettingsNames{
min = "min",
Expand All @@ -31,6 +32,10 @@ export enum AxisSettingsNames {
xAxis = "xAxis",
yAxis = "yAxis"
}
export enum ZoomingSettingsNames{
show = "show",
maximum = "maximum"
}

export enum PlotTitleSettingsNames {
title = "title"
Expand Down
12 changes: 9 additions & 3 deletions src/parseAndTransform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import IVisualHost = powerbi.extensibility.visual.IVisualHost;
import VisualUpdateOptions = powerbi.extensibility.visual.VisualUpdateOptions;
import ISandboxExtendedColorPalette = powerbi.extensibility.ISandboxExtendedColorPalette;
import { getValue, getColumnnColorByIndex, getAxisTextFillColor, getPlotFillColor, getColorSettings } from './objectEnumerationUtility';
import { ViewModel, DataPoint, FormatSettings, PlotSettings, PlotModel, TooltipDataPoint, XAxisData, YAxisData, PlotType, SlabRectangle, SlabType, GeneralPlotSettings, Margins, AxisInformation, AxisInformationInterface, TooltipModel } from './plotInterface';
import { ViewModel, DataPoint, FormatSettings, PlotSettings, PlotModel, TooltipDataPoint, XAxisData, YAxisData, PlotType, SlabRectangle, SlabType, GeneralPlotSettings, Margins, AxisInformation, AxisInformationInterface, TooltipModel, ZoomingSettings } from './plotInterface';
import { Color } from 'd3';
import { AxisSettingsNames, PlotSettingsNames, Settings, ColorSettingsNames, OverlayPlotSettingsNames, PlotTitleSettingsNames, TooltipTitleSettingsNames, YRangeSettingsNames } from './constants';
import { AxisSettingsNames, PlotSettingsNames, Settings, ColorSettingsNames, OverlayPlotSettingsNames, PlotTitleSettingsNames, TooltipTitleSettingsNames, YRangeSettingsNames, ZoomingSettingsNames } from './constants';
import { MarginSettings } from './marginSettings'
import { ok, err, Result } from 'neverthrow'
import { AxisError, AxisNullValuesError, GetAxisInformationError, NoAxisError, NoValuesError, ParseAndTransformError, PlotSizeError, SVGSizeError } from './errors'
Expand Down Expand Up @@ -350,6 +350,11 @@ function createViewModel(options: VisualUpdateOptions, yCount: number, objects:
margins: margins.margins
};

const zoomingSettings: ZoomingSettings = {
enableZoom: <boolean>getValue(objects, Settings.zoomingSettings, ZoomingSettingsNames.show, true),
maximumZoom: <number>getValue(objects, Settings.zoomingSettings, ZoomingSettingsNames.maximum, 10)
}

let viewModel: ViewModel = <ViewModel>{
plotModels: new Array<PlotModel>(yCount),
colorSettings: {
Expand All @@ -363,7 +368,8 @@ function createViewModel(options: VisualUpdateOptions, yCount: number, objects:
slabRectangles: [],
svgHeight: svgHeight,
svgTopPadding: margins.svgTopPadding,
svgWidth: svgWidth
svgWidth: svgWidth,
zoomingSettings: zoomingSettings
};
return ok(viewModel);
}
Expand Down
6 changes: 6 additions & 0 deletions src/plotInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export interface ViewModel {
svgTopPadding: number;
generalPlotSettings: GeneralPlotSettings;
tooltipModels: TooltipModel[];
zoomingSettings: ZoomingSettings;
}

export interface GeneralPlotSettings {
Expand Down Expand Up @@ -42,6 +43,11 @@ export interface ColorSettings {
}
}

export interface ZoomingSettings{
enableZoom: boolean;
maximumZoom: number;
}

export enum PlotType {
//BarPlot = "BarPlot",
ScatterPlot = "ScatterPlot",
Expand Down
Loading

0 comments on commit acb31fb

Please sign in to comment.