Skip to content

Commit a658e5a

Browse files
authored
Remove interactivity utils (#127)
* Remove behavior classes * Remove interactivity utils from legend * Remove interactivity utils from packages * Remove interactivity utils from labels * Fix legend tests * Increment version * Increase version to 7.0.0 * Add interface for selectable dataPoint * Fix eslint * Update docs * Remove interactive legend class * Update docs * Update changelog * Update changelog * Update docs * Use beta version --------- Co-authored-by: Iuliia Kulagina <v-ikulagina@microsoft.com>
1 parent 2f4b09e commit a658e5a

19 files changed

Lines changed: 31 additions & 1067 deletions

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 7.0.0
2+
* Removed interactivityutils and related code
3+
* Removed interactiveLegend class
4+
* Changed createLegend function signature -> createLegend(HTMLElement, boolean, LegendPosition)
5+
16
## 6.0.4
27
* Updated powerbi-visuals-api to 5.9.0 and other utils
38

docs/api/legend.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ This helper function simplifies PowerBI Custom Visual legends creation.
1212

1313
```typescript
1414
function createLegend(legendParentElement: HTMLElement, // top visual element, container in which legend will be created
15-
interactive: boolean, // indicates that legend should be interactive
16-
interactivityService: IInteractivityService, // reference to IInteractivityService interface which need to create legend click events
1715
isScrollable: boolean = false, // indicates that legend could be scrollable or not
1816
legendPosition: LegendPosition = LegendPosition.Top // Position of the legend inside of legendParentElement container
1917
): ILegend;
@@ -31,13 +29,8 @@ function createLegend(legendParentElement: HTMLElement, // top visual e
3129

3230
//... some other init calls
3331

34-
if (this.behavior) {
35-
this.interactivityService = createInteractivityService(hostServices);
36-
}
3732
this.legend = createLegend(
3833
element,
39-
options.interactivity && options.interactivity.isInteractiveLegend,
40-
this.interactivityService,
4134
true);
4235
}
4336
```

docs/dev/development-workflow.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ npm run build
4848
This command compiles less code to CSS and TypeScript code to JavaScript. The result of the compilation is available in the ```lib``` directory.
4949

5050
## How to lint the source code
51-
We use [TSLint](https://github.com/palantir/tslint) as a linter for TypeScript code. To check source code you should run the following command:
51+
We use [eslint](https://github.com/eslint/eslint) as a linter for TypeScript code. To check source code you should run the following command:
5252

5353
```bash
5454
npm run lint
5555
```
5656

57-
This command checks style of TypeScript code and provides a list of problems. Please address all of problems reported by TSLint before sending a pull request to the [repository](https://github.com/Microsoft/powerbi-visuals-utils-chartutils).
57+
This command checks style of TypeScript code and provides a list of problems. Please address all of problems reported by eslint before sending a pull request to the [repository](https://github.com/Microsoft/powerbi-visuals-utils-chartutils).
5858

5959
## How to run unit tests locally
6060
We use [Jasmine](https://github.com/jasmine/jasmine) and [Karma](https://github.com/karma-runner/karma) to run unit tests. Please note, Karma requires Google Chrome to run unit tests.

docs/usage/installation-guide.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ This command installs the package and adds a package as a dependency to your ```
2525
The package contains ```d.ts``` declarations file, it's necessary for TypeScript compiler and it helps to develop your visuals fast and confident. You should add the following files to the ```files``` property of ```tsconfig.json```:
2626
* ```typings/index.d.ts```
2727
* ```node_modules/powerbi-visuals-utils-formattingutils/lib/index.d.ts```
28-
* ```node_modules/powerbi-visuals-utils-interactivityutils/lib/index.d.ts```
2928
* ```node_modules/powerbi-visuals-utils-svgutils/lib/index.d.ts```
3029
* ```node_modules/powerbi-visuals-utils-typeutils/lib/index.d.ts```
3130
* ```node_modules/powerbi-visuals-utils-chartutils/lib/index.d.ts```
@@ -37,7 +36,6 @@ As a result you will have the following file structure:
3736
"files": [
3837
"typings/index.d.ts",
3938
"node_modules/powerbi-visuals-utils-formattingutils/lib/index.d.ts",
40-
"node_modules/powerbi-visuals-utils-interactivityutils/lib/index.d.ts",
4139
"node_modules/powerbi-visuals-utils-svgutils/lib/index.d.ts",
4240
"node_modules/powerbi-visuals-utils-typeutils/lib/index.d.ts",
4341
"node_modules/powerbi-visuals-utils-chartutils/lib/index.d.ts"
@@ -53,7 +51,6 @@ To use the package with your custom visuals you should add the following files t
5351
* ```node_modules/powerbi-visuals-utils-typeutils/lib/index.js```
5452
* ```node_modules/powerbi-visuals-utils-svgutils/lib/index.js```
5553
* ```node_modules/powerbi-visuals-utils-formattingutils/lib/index.js```
56-
* ```node_modules/powerbi-visuals-utils-interactivityutils/lib/index.js```
5754
* ```node_modules/powerbi-visuals-utils-chartutils/lib/index.js```
5855

5956
As a result you will have the following file structure:
@@ -70,7 +67,6 @@ As a result you will have the following file structure:
7067
"node_modules/powerbi-visuals-utils-typeutils/lib/index.js",
7168
"node_modules/powerbi-visuals-utils-svgutils/lib/index.js",
7269
"node_modules/powerbi-visuals-utils-formattingutils/lib/index.js",
73-
"node_modules/powerbi-visuals-utils-interactivityutils/lib/index.js",
7470
"node_modules/powerbi-visuals-utils-chartutils/lib/index.js"
7571
],
7672
"style": ...,
@@ -81,12 +77,10 @@ As a result you will have the following file structure:
8177
## Including CSS artifacts to the custom visual
8278
To use the package with your custom visuals you should import the following CSS files to your ```.less``` file:
8379

84-
* ```node_modules/powerbi-visuals-utils-interactivityutils/lib/index.css```
8580
* ```node_modules/powerbi-visuals-utils-chartutils/lib/index.css```
8681

8782
As a result you will have the following file structure:
8883
```less
89-
@import (less) "node_modules/powerbi-visuals-utils-interactivityutils/lib/index.css";
9084
@import (less) "node_modules/powerbi-visuals-utils-chartutils/lib/index.css";
9185
```
9286

docs/usage/usage-guide.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ This package contains the following classes, interfaces and methods:
66
* [Axis Helper](../api/axis-helper.md) - provide all necessary methods to maintain chart axes
77
* [DataLabelManager](../api/data-label-manager.md) - helps to create and maintain labels
88
* [DataLabelUtils](../api/data-label-utils.md) - label manager utils
9+
* [Legend](../api/legend.md) - helps to create and mantain legend

package-lock.json

Lines changed: 2 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "powerbi-visuals-utils-chartutils",
3-
"version": "6.0.4",
3+
"version": "7.0.0-beta.1",
44
"description": "ChartUtils",
55
"main": "lib/index.js",
66
"module": "lib/index.js",
@@ -72,7 +72,6 @@
7272
"d3-selection": "^3.0.0",
7373
"d3-transition": "^3.0.1",
7474
"powerbi-visuals-utils-formattingutils": "^6.1.1",
75-
"powerbi-visuals-utils-interactivityutils": "^6.0.4",
7675
"powerbi-visuals-utils-svgutils": "^6.0.4",
7776
"powerbi-visuals-utils-typeutils": "^6.0.3"
7877
},

src/dataLabel/dataLabelUtils.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,6 @@ import * as svg from "powerbi-visuals-utils-svgutils";
4949
import ClassAndSelector = svg.CssConstants.ClassAndSelector;
5050
import createClassAndSelector = svg.CssConstants.createClassAndSelector;
5151

52-
// powerbi.extensibility.utils.interactivity
53-
import { interactivitySelectionService } from "powerbi-visuals-utils-interactivityutils";
54-
import SelectionDataPoint = interactivitySelectionService.SelectableDataPoint;
55-
5652
import * as dataLabelInterfaces from "./dataLabelInterfaces";
5753
import LabelFormattedTextOptions = dataLabelInterfaces.LabelFormattedTextOptions;
5854
import LabelEnabledDataPoint = dataLabelInterfaces.LabelEnabledDataPoint;
@@ -216,7 +212,7 @@ export function drawDefaultLabelsForDataPointChart(data: any[], context: Selecti
216212
.transition("")
217213
.duration(animationDuration)
218214
// .style(layout.style as any)
219-
.style("opacity", (hasSelection ? (d: SelectionDataPoint) => getFillOpacity(d.selected, false, hasSelection, false) : 1) as any)
215+
.style("opacity", (hasSelection ? d => getFillOpacity(d.selected, false, hasSelection, false) : 1) as any)
220216
.attr(
221217
"x", (d: LabelEnabledDataPoint) => d.labelX
222218
)
@@ -260,7 +256,7 @@ function selectLabels(filteredData: LabelEnabledDataPoint[], context: Selection<
260256
const getIdentifier = hasKey ?
261257
(d: any) => d.key
262258
: hasDataPointIdentity ?
263-
(d: SelectionDataPoint) => (d.identity as ISelectionId).getKey()
259+
d => (d.identity as ISelectionId).getKey()
264260
: undefined;
265261

266262
const labels: Selection<any, any, any, any> = isDonut ?

src/index.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@ import DataLabelManager from "./dataLabel/dataLabelManager";
99
import * as dataLabelUtils from "./dataLabel/dataLabelUtils";
1010
import * as locationConverter from "./dataLabel/locationConverter";
1111

12-
import * as interactiveLegend from "./legend/interactiveLegend";
1312
import * as legend from "./legend/legend";
14-
import * as legendBehavior from "./legend/behavior/legendBehavior";
15-
import OpacityLegendBehavior from "./legend/behavior/opacityLegendBehavior";
1613
import * as legendData from "./legend/legendData";
1714
import * as legendInterfaces from "./legend/legendInterfaces";
1815
import * as legendPosition from "./legend/legendPosition";
@@ -30,11 +27,8 @@ export {
3027
DataLabelManager,
3128
dataLabelUtils,
3229
locationConverter,
33-
interactiveLegend,
3430
label,
3531
legend,
36-
legendBehavior,
37-
OpacityLegendBehavior,
3832
legendData,
3933
legendInterfaces,
4034
legendPosition,

src/label/labelLayout.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,15 @@ import {
3232
IRect,
3333
} from "powerbi-visuals-utils-svgutils";
3434

35-
import {
36-
interactivitySelectionService
37-
} from "powerbi-visuals-utils-interactivityutils";
38-
3935
import { FontProperties, inherit } from "./fontProperties";
4036
import * as LabelUtils from "./labelUtils";
4137
import * as Units from "./units";
4238

4339
import * as DataLabelRectPositioner from "./dataLabelRectPositioner";
4440
import * as DataLabelPointPositioner from "./dataLabelPointPositioner";
4541

42+
import { ISelectableDataPoint } from "../legend/legendInterfaces";
43+
4644
export enum LabelOrientation {
4745
Vertical = 0,
4846
Horizontal = 1,
@@ -324,7 +322,7 @@ export interface LabelDataPointGroup<TLabelDataPoint> {
324322
labelOrientation?: LabelOrientation;
325323
}
326324

327-
export interface Label extends interactivitySelectionService.SelectableDataPoint {
325+
export interface Label extends ISelectableDataPoint {
328326
/** Text to be displayed in the label */
329327
text: string;
330328

@@ -363,7 +361,7 @@ export interface Label extends interactivitySelectionService.SelectableDataPoint
363361
backgroundTransparency?: number;
364362
}
365363

366-
export interface LabelOld extends interactivitySelectionService.SelectableDataPoint {
364+
export interface LabelOld extends ISelectableDataPoint{
367365
/** Text to be displayed in the label */
368366
text: string;
369367

0 commit comments

Comments
 (0)