Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

powerbi-client + custom visual. Setting border value #507

Closed
swiecaJS opened this issue Feb 12, 2024 · 5 comments
Closed

powerbi-client + custom visual. Setting border value #507

swiecaJS opened this issue Feb 12, 2024 · 5 comments

Comments

@swiecaJS
Copy link

I want to set the border on my custom-built visual programmatically.
It works perfectly when changed via powerbi web app (or desktop)

However, as soon as I try to use powerbi-client library I get an error. The same code works without an issue on the build-in visuals.

My code:

export const setActiveBorder = async (visual: VisualDescriptor | undefined) => {
  try {
    await visual?.setProperty(
      {
        objectName: 'border',
        propertyName: 'visible',
      },
      {
        value: true,
      },
    )

    await visual?.setProperty(
      {
        objectName: 'border',
        propertyName: 'radius',
      },
      {
        value: 8,
      },
    )
    await visual?.setProperty(
      {
        objectName: 'border',
        propertyName: 'color',
      },
      {
        value: '#ff0000',
      },
    )
  } catch (error) {
    console.error('setting active border failed', error)
  }
}

Error message:

{
    "message": "setPropertyFailed",
    "detailedMessage": "Set visual property failed"
}

The same behavior happens with the blank new visual created through pbiviz new, making the error easy to replicate.
powerbi-client repo does not accept the issues, so I am leaving an issue here, because I believe the problem lies somewhere at the intersection

@AleksSavelev
Copy link
Contributor

Hello @swiecaJS,

I'm not sure why do you use setProperty in this case. Are there any reasons to do so?

Usually you can simply change the value of the setting directly in getFormattingModel. Please, take a look on this documentation

@swiecaJS
Copy link
Author

@AleksSavelev my reports are embedded on a webpage with the use of powerbi-client library.

setProperty is a part of power bi client API, see documenation

@swiecaJS
Copy link
Author

To have a clear reproduction step

  1. Create a blank visual with pbiviz create
  2. Put that visual on a report
  3. Open that report in the embed mode, for example by using playground
  4. Try to change the border using setProperty
  5. Error happens

@AleksSavelev
Copy link
Contributor

Oh, I see.
Could you, please, contact us on email pbicvsupport@microsoft.com and describe this issue one more time. Support guys will add the responsible team to the discussion.

@AleksSavelev
Copy link
Contributor

I'll close the issue as it's not related to the tools itself, but feel free to contact the support email with any questions.

@AleksSavelev AleksSavelev closed this as not planned Won't fix, can't repro, duplicate, stale Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants