Git Product home page Git Product logo

powerbi-visuals-api's Introduction

Microsoft PowerBI Custom Visuals API

npm version npm

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

powerbi-visuals-api's People

Contributors

alekssavelev avatar anitamayorov avatar asafmozes avatar asanovarthur avatar dbrailov avatar demonkratiy avatar gekeldaw avatar gennadylaventman avatar guy-moses avatar ignatvilesov avatar jennyfel avatar manikandanvengatesan avatar microsoft-github-policy-service[bot] avatar microsoftopensource avatar mitjabezensek avatar msftgits avatar mulyukovaidar avatar ramizsh avatar ramizsha avatar roi-hochler avatar shafeeqz avatar uve avatar v-jiepeng avatar yarovinsky avatar zbritva avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

powerbi-visuals-api's Issues

ESLint problem applying powerbi.visuals.FormattingComponent.TextInput in Simple slice.

Why does this code:

 const dataCard: powerbi.visuals.FormattingCard = {
           description: "Data Card Description",
           displayName: "Data Card",
           uid: "dataCard_uid",            
           groups: [
               {
                   displayName: undefined,
                   uid: "licenseCard_group1_uid",
                   slices: [
                       {
                           displayName: "Font Color",
                           uid: "dataCard_dataDesign_fontColor_slice",
                           control: {
                               type: powerbi.visuals.FormattingComponent.TextInput,
                               properties: {
                                   descriptor:
                                   {
                                       objectName: "dataCard",
                                       propertyName: "fontColor"
                                   },
                                   value: { value: "#01B8AA" }
                               }
                           }
                       },                       
                   ]
               }
           ]
       };  

cause eslint to produce this error on "type"?

Type 'FormattingComponent.TextInput' is not assignable to type '"FontControl" | "MarginPadding"'.

4.1.0 Matrix Expand Collapse

I created a visual with Matrix expand collapse feature. I was successful in creating it. In development mode it works like a charm but when I try to package it, it gets stuck and expand collapse does not work on calling this.selectionManager.toggleExpandCollapse(nodeSelectionId) and the same throws error in desktop mode.

I have given a link to the repo below and the data set I used.

visuals-tools: 4.0.4
visuals-api: 4.1.0

https://github.com/vicktor3/matrixviz
mode2AutoGen.csv

Reference: https://docs.microsoft.com/en-us/power-bi/developer/visuals/dataview-mappings#expanding-and-collapsing-row-headers

Dataflow: CancelDataflowTransaction method accepts GUID, expects STRING

Wrong data type in method....CancelDataflowTransactionAsync

The method's signature is:

CancelDataflowTransactionAsync(Guid groupId, Guid transactionId, CancellationToken cancellationToken)

However, when querying a Dataflow Transaction, the ID is of type "string" with a DateTime stamp separated by @, a GUID, and an integer separated by a $.

2023-10-03T20:48:31.3705645Z@fbf334ab-55ec-47e1-8ded-705cc5785903$20449390

When reading the Power BI API documentation, the /cancel endpoint takes the string, so the method doesn't accept the right type. TransactionId needs to be changed to a string so the cancel call can be made.

(Even the "WithHttpMessage" version takes a Guid, so it needs to be fixed all the way down the stack.)

Formatting Containers - how to differentiate changes between containers

When using the FormattingContainer, any changes the user makes on the formatting panel are only recorded in the DataViewModel.metadata and can not be differentiated per container.

In previous API versions, changes would be recorded in the DataViewModel.categorical.values.source.objects, recording any changes from default per value.

This behaviour seems to have changed in the API version 6.0.0

How do I detect in which FormattingContainerItem the user has made changes?

Feat: multiline text

Currently, it is only possible to add text properties to a single line, however, it is a bad experience for the user, especially if needs to break lines.

The property below generates the following field:

// capabilities.json
    "objects": {
      "myProp": {
        "properties": {
          "myProp": {
            "type": { "text": true }
          }
        }
      },

image

It would be cool to be able to use a multiline text like the alt text present in the visuals:

image

Add a "displayNameKey" to the IEnumMember interface

Within powerbi-visuals-utils-formattingmodel, the ItemDropdown slicer utilizes the IEnumMember interface within the definitions.ts file for its dropdown items and value. However, there is no way to have these dropdown items to be translated into other languages. If there is a way to have the IEnumMember have not only a displayNameKey associated with the interface but the ability to translate said key would be much appreciated.

Power BI Custom Control Export Data

How can we enable the customer visual API to export the underlying data from a button on the custom chart, i,.e. not going through the context menus.

thanks

Toby.

Visual update event does not support the new 'Clear all slicers' button

If the new Clear all slicers button is selected on the report page the custom visual update event is triggered. However the instance of VisualUpdateOptions still keeps filters applied by the custom visual. Becaus of this it is not possible to support the Clear all slicers button for custom slicers. So it seems that it only resets the native slicers.

This is what the instance of VisualUpdateOptions looks like after the Clear all slicers button is selected:

image

Update event still holding the table data even when everything is removed.

Hi,

I've only just started with the custom visuals so I might have missed something but I've tried to my best research.

PBI Visuals API Version: 4.7.0

I'm trying to create simple custom visual that will be rendering the JSON data of a single selection. I cannot use the single dataViewMapping, hence using the table. For testing I have a simplest table with one column and one row that contains the JSON data.

capabilities.json:

    "privileges": [],
    "dataRoles": [
        {
            "displayName": "JSON Data",
            "name": "jsonData",
            "kind": "GroupingOrMeasure"
        }
    ],
    "dataViewMappings": [
        {
            "conditions": [{"jsonData":  { "min":  1, "max": 1}}],
            "table": { "rows": {
                "for": {
                    "in": "jsonData"
                }
            }}
        }
    ]

visual.ts:

   public update(options: VisualUpdateOptions) {
        this.settings = Visual.parseSettings(options && options.dataViews && options.dataViews[0]);
        console.log('Update: ', options);
        const dataView: DataView = options.dataViews[0];
        const dataViewDatable: DataViewTable = dataView.table;
        const dataViewRow: DataViewTableRow = dataViewDatable.rows[0];

        console.log('Visual update', this.jsonViewerInstance);
        if (this.jsonViewerInstance && this.jsonViewerInstance.json != JSON.parse(<string>dataViewRow[0])) {
           this.renderJSON(dataViewRow[0]);
        }


        // You could've done this also using the 
        // this.visualSettings = VisualSettings.parse<VisualSettings>(dataView);

        if (options.dataViews[0].metadata && options.dataViews[0].metadata.objects.jsonFormatterProperties.fontSize) {
            this.parentElement.style.fontSize = options.dataViews[0].metadata.objects.jsonFormatterProperties.fontSize + 'px';
        }
        if (options.dataViews[0].metadata && options.dataViews[0].metadata.objects.jsonFormatterProperties.fontFamily) {
            this.parentElement.style.fontFamily = <string>options.dataViews[0].metadata.objects.jsonFormatterProperties.fontFamily;
        }
    }

However, when I remove that single column from the visual's JSON Data property, the update is fired but the dataViews still contain the table data so I don't know when to clear the visual ?!

image

There is this odd type=36 event but I don't know what that refers to.
According the typings: https://github.com/microsoft/powerbi-visuals-api/blob/main/index.d.ts the type=36 is not even included?

Thank you for any pointers.

Upgrade from 3.8 to 4.6 renders nothing

Hi,

I am experiencing issues when upgrading existing visuals that used api version 3.8 to 4.6. After adding privileges to capabilities.json the visual compiles fine. However, nothing renders in the visual sandbox.

I have added logs to both the visual constructor and update function, but it seems those are never called. I decided to give the demo visual a go and I am having the same troubles with that one.
I have powerbi-visuals-tools version - 4.0.5 installed
All I did is:

  1. pbiviz new CircleCard
  2. deleted package-lock.json,
  3. changed "powerbi-visuals-api": "~3.8.0" to "powerbi-visuals-api": "~4.6.0", in package.json
  4. changed "apiVersion":"3.8.0" to "apiVersion":"4.6.0" in pbiviz.json
  5. hit npm install
  6. added "privileges: []" to capabilities.json
  7. hit pbiviz start

The result is webpack 5.73.0 compiled successfully in 3506 ms
However, when I try to load the visual in the developer visual in PowerBi.com, it renders blank. When I change the api version back to 3.8 it renders just fine...

Formatting pane Slider control - untiSymbol and unitSymbolAfterInput

Using the following code:

const slice: powerbi.visuals.FormattingSlice = { displayName: displayName, uid: uid, control: { type: powerbi.visuals.FormattingComponent.Slider, properties: { descriptor: { objectName: object, propertyName: propertyName }, value: value, options: { unitSymbol: "$", unitSymbolAfterInput: true } } } };

I expect a $ character to be shown next to the Slider input field. Nothing is being rendered however.
Am I expecting the wrong thing?

Method update on Visual does not work when all fields are removed from dataview

When adding or removing fields into/from dataview the update method triggers as expected but when the last field is removed from dataview the update method does not trigger.

Tested using the following specs:
powerbi-visuals-api: 5.4.0

Tested on the following environment:
Custom Visual for PowerBI using TypeScript provider for rendering
*When Custom Visual is using R provider then the r script is triggered even on last field removal

Formatting pane - conditional formatting not showing property name

Using this code:

const slice: powerbi.visuals.FormattingSlice = { displayName: displayName, uid: uid, control: { type: powerbi.visuals.FormattingComponent.ColorPicker, properties: { descriptor: { objectName: object, propertyName: propertyName, selector: dataViewWildcard.createDataViewWildcardSelector(dataViewWildcard.DataViewWildcardMatchingOption.InstancesAndTotals), altConstantValueSelector: null, instanceKind: powerbi.VisualEnumerationInstanceKinds.ConstantOrRule }, value: { value: color }, } } };

A conditional formatting pop up is shown after pressing the Fx button, with the title:

'Undefined - ' followed by whatever 'object' is.

I am expecting the propertyName to be printed where 'undefined' is shown. This is how the previous version of the API worked as far as I know.

PowerBI Settings object dependency

While designing and developing complex powerbi custom visuals like the following which performs process mining over your dataset, the available chart types may be a lot. In this case, if selected chart type is "Process Map" should have its own sub settings while the chart type is "Resource Matrix" should have other settings displayed.

image

Is there any way to archive display of settings which depends on another setting, in this example "Process Map Method" setting belongs to chart type "Process Map" and "Resource Matrix Settings" to chart type "Resource Matrix" ?

image

Total and Subtotal API not working with select-for-in expression in the data view mapping of the matrix object

Good day to you all!

I am reaching out regarding an issue I am facing with the Total and Subtotal API.

The Power BI custom visual we are developing is not retrieving any data and seems to be stuck in data query/loading process (the indicator in the top left corner is constantly visible) whenever using the Total and Subtotal API in combination with multiple data roles in the select-for-in expression in the data view mapping of the matrix object data view mapping of the matrix object.

The issue can be reproduced using the sample matrix (GitHub - microsoft/Powerbi-Visuals-SampleMatrix: demonstrates a powerbi matrix custom visual) and following these steps modifying the capabilities.json:

  1. Add another grouping data role in the capabilities.json
  2. Add the newly added data role to the row data view mapping of the matrix using select-for-in expression
  3. Run the visual
    a. The loading indicator in the top left corner of the visual is showing permanently, seemingly stuck at the data retrieval stage
    b. When exporting the dataViews.json it shows no data

The capabilities.json should look something like this: capabilities.json

Closing dialog box bug in Power Bi Desktop

Hello

I'm developing a custom visual that uses a dialog box, following the instructions here:
https://learn.microsoft.com/en-us/power-bi/developer/visuals/create-display-dialog-box

In that documentation, it is mentioned that you can close the dialog box by calling the:
IDialogHost.close(actionId: DialogAction, result?:object)
method, but that there is a delay of five seconds after the dialog box has opened before you can close it this way, here's the relevant passage from the docs:

You can also program the dialog box to automatically close by calling the IDialogHost close method. This method is blocked for five seconds after the dialog is opened, so that the earliest you can automatically close the dialog box is five seconds after it was initiated.

However, while this seems to work perfectly as advertised in the web version of Power Bi, there seems to be something broken when that method is used in Power Bi Desktop.

In particular, when using Power Bi Desktop I'm experiencing a very long delay (even 20-30 seconds) between calling the close() method and the dialog box actually closing. Furthermore, this delay happens even if the 5 seconds mentioned in the docs have passed, it does not seem tied to that timer at all, it just takes a very long time to close regardless of how long the dialog box has been open.

Is this a bug? Am I missing something?
Here some more info:

  • Using API versione 5.3.0
  • Tested on latest available version of Power Bi at time of writing
  • Only affects Power Bi Desktop, works as intended in the web version
  • This does not happen if using the native dialog buttons, it only happens when closing the popup via code with the IDialogHost.close(...) method

Drill-down support do not work as expected

Hello,
I'm having an issue with the drill-down support. I have created an Hierarchy as described in the documentation and I'm using some measures. Specifically the measures check which level is filtered and some the desired value. In a default bar chart it works as expected.

The issue comes in my custom implementation which changes the labels only the first measure data and not for the rest. The field setup can be shown below:

image

I cannot find anything on the documentation or in Google. Any ideas? Is it a bug? Or it's my code?

Add $schema Support to capabilities.json

There should be a $schema prop like this:

{
 "$schema": "https://raw.githubusercontent.com/microsoft/powerbi-visuals-api/main/schema.capabilities.json",
...
}

In the capabilities.json files.

Basically, "$schema": "http://json-schema.org/draft-07/schema", is missing in

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.