GithubHelp home page GithubHelp logo

microsoft / powerbi-visuals-utils-typeutils Goto Github PK

View Code? Open in Web Editor NEW
14.0 14.0 32.0 698 KB

Type utility interfaces for creating powerbi custom visuals

License: Other

JavaScript 0.87% TypeScript 99.13%

powerbi-visuals-utils-typeutils's Introduction

Microsoft Power BI visuals TypeUtils

Build npm version npm

TypeUtils is a set of functions and classes in order to extend the basic types for Power BI custom visuals

Usage

Learn how to install and use the TypeUtils in your custom visuals:

Contributing

License

See the LICENSE file for license rights and limitations (MIT).

powerbi-visuals-utils-typeutils's People

Contributors

adiletelf avatar alekssavelev avatar avisander avatar blackleaden avatar demonkratiy avatar eugeneelkin avatar ignatvilesov avatar microsoft-github-policy-service[bot] avatar mrmeison avatar savvinsergey avatar uve avatar zbritva avatar

Stargazers

 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

powerbi-visuals-utils-typeutils's Issues

Double.roundToPrecision rounding issue

There is an issue with this line in Double.roundToPrecision

let result = Math.round(x / precision) * precision;

I encountered this issue because the formattingutils use this function in the valueFormatter so that for a common configuration the formatting of e.g. 0.2 returns 0.19999999999999998. See this issue for details.
I found this thread which discusses different rounding to precision implementations and their caveats. The one that is working for me is this implementation

function roundToTwo(num) {    
    return +(Math.round(num + "e+2")  + "e-2");
}

which I adjusted to this

function bestRound(x: number, precision: number) {
  let p = Math.abs(precision);
  let p1 = precision > 0 ? `-${p}` : `+${p}`;
  let p2 = precision > 0 ? `+${p}` : `-${p}`;
  return +(Math.round(x + `e${p1}` as any)  + `e${p2}`);
}

although it's difficult to say if there are edge cases where it won't work. You can see my fix here. Let me know if I should send a pull request.

Maximum font size cannot be larger than 40

The PR #10 addresses this issue:

Allows visuals to use bigger fonts than 40. (Example: Synoptic panel). The number 100 is an arbitrary choice. We've seen scenarios where we wanted to use font size 72.

Uncaught TypeError: Cannot read property 'PixelConverter' of undefined

Hi there,

I added and was using powerbi.extensibility.utils.type.PixelConverter into my custom visual and it was working fine for some time then it started giving me following error.
alt text
alt text
I tried removing node_modules and installed all the library again but still I am getting this issue. Can you please help me solve this issue? following are the imports in package.json and pbiviz.json

package.json

{
  "name": "advancecard",
  "version": "1.0.7",
  "dependencies": {
    "@types/d3": "^3.5.41",
    "d3": "^3.5.17",
    "powerbi-visuals-utils-dataviewutils": "1.2.0",
    "powerbi-visuals-utils-formattingutils": "^3.0.2",
    "powerbi-visuals-utils-svgutils": "^1.1.0",
    "powerbi-visuals-utils-tooltiputils": "^1.0.1",
    "powerbi-visuals-utils-typeutils": "^1.1.0",
    "typescript": "^2.8"
  }
}

pbivz.json

  "externalJS": [
    "node_modules/powerbi-visuals-utils-dataviewutils/lib/index.js",
    "node_modules/d3/d3.js",
    "node_modules/globalize/lib/globalize.js",
    "node_modules/globalize/lib/cultures/globalize.cultures.js",
    "node_modules/powerbi-visuals-utils-dataviewutils/lib/index.js",
    "node_modules/powerbi-visuals-utils-formattingutils/lib/index.js",
    "node_modules/powerbi-visuals-utils-tooltiputils/lib/index.js",
    "node_modules/powerbi-visuals-utils-typeutils/lib/index.js",
    "node_modules/powerbi-visuals-utils-svgutils/lib/index.js"
  ]

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.