Comments (9)
You should follow the steps in this GitHub sample visual: https://github.com/Microsoft/PowerBI-visuals-sampleUsingExternalLibraries
from powerbi-visuals-tools.
Thank you for your answer.
I have followed this sample and have followed the article for referencing the d3
library (https://github.com/Microsoft/PowerBI-visuals/blob/master/Tutorial/Typings.md).
Those steps are working fine for those libraries however they are not helping me with the request
module. Apparently its definition or implementation differs somehow.
Could you try to create a new visual project, do the same steps and use that library in the visual.ts file?
Or maybe you know another library that could help me with HTTP GET requests?
from powerbi-visuals-tools.
Several things:
- Did you include the request library in the tsconfig.json file?
- What API version are you targeting? Starting from API 1.2 you will not have D3 included in the IFRAME web page, and you will have to compile with D3 (add it to the tsconfig.json file)
- Even if you will be able to properly compile and run with this library, I'm not sure the browser or remote server will allow you to invoke the HTTP GET request. Currently, custom visuals are sandboxed in such a way that they don't have a defined origin (origin = null), this will cause most servers to reject your requests.
from powerbi-visuals-tools.
- Yes, here an extract from my tsconfic.json file:
"files": [
".api/v1.2.0/PowerBI-visuals.d.ts",
"typings/index.d.ts",
"node_modules/request/request.js",
"src/visual.ts"
]
And from my typings/index.d.ts as well:
/// <reference path="globals/form-data/index.d.ts" />
/// <reference path="globals/node/index.d.ts" />
/// <reference path="globals/request/index.d.ts" />
- The
pbiviz -V
gives me 1.2.1 version number.
The problem is not with theD3
module but with therequest
one. - OK, I was afraid of something like that.
Still I would like to try it first.
from powerbi-visuals-tools.
I've made these screenshots to be sure that I explain everything properly.
Here is the screenshot from VS Code when the import statement is commented out.
You can see that there is no objects from the request
library even if it is referenced in the index.d.ts
file:
And here I uncommented the import statement. You can see that the default request
function is there and referenced properly.
But those red squiggles mark those error messages I've mentioned in the first post here:
error TYPESCRIPT /src/visual.ts : (4,36) Cannot find name 'IVisual'.
error TYPESCRIPT /src/visual.ts : (8,30) Cannot find name 'VisualConstructorOptions'.
error TYPESCRIPT /src/visual.ts : (14,32) Cannot find name 'VisualUpdateOptions'.
The request's index.d.ts is there and looks fine:
// Generated by typings
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/658d360c6a8611e76f7cc75c07fcd0f02055ffc4/request/request.d.ts
declare module 'request' {
import stream = require('stream');
import http = require('http');
import https = require('https');
import url = require('url');
import fs = require('fs');
import FormData = require('form-data');
namespace request {
export interface RequestAPI<TRequest extends Request,
TOptions extends CoreOptions,
TUriUrlOptions> {
defaults(options: TOptions): RequestAPI<TRequest, TOptions, RequiredUriUrl>;
defaults(options: RequiredUriUrl & TOptions): DefaultUriUrlRequestApi<TRequest, TOptions, OptionalUriUrl>;
(uri: string, options?: TOptions, callback?: RequestCallback): TRequest;
(uri: string, callback?: RequestCallback): TRequest;
(options: TUriUrlOptions & TOptions, callback?: RequestCallback): TRequest;
............
}
var request: request.RequestAPI<request.Request, request.CoreOptions, request.RequiredUriUrl>;
export = request;
}
So how should I reference that library in my code?
from powerbi-visuals-tools.
Please try to see if this blog helps http://blog.jongallant.com/2016/09/how-to-create-power-bi-custom-visual.html
from powerbi-visuals-tools.
Cross-posting from https://github.com/Microsoft/PowerBI-visuals/issues/99 since that might be a better place: Power BI seems to break external libraries like vis.js that try to attach themselves to the window
object.
from powerbi-visuals-tools.
@helen508light were you able to resolve this? I am running into something similar but cannot find a straightforward answer.
from powerbi-visuals-tools.
@sfuchickie what issue do you have?
from powerbi-visuals-tools.
Related Issues (20)
- Rapport présentant la proportion d'hommes et de femmes qui demandent de l'emploi en CÔTE D'IVOIRE.
- Rapport montrant la répartition des produits de consommation en Côte d’Ivoire HOT 1
- Unable to create visual; HOT 4
- Unable to create visual HOT 1
- unable to install pbiviz HOT 1
- If a visual filtered by a date type field, then the selection is not working well. HOT 1
- Packed visual behaves differently. DataViewMetadata has different entries for the same data mapping in dev/prod mode HOT 2
- Passing query parameter to server HOT 3
- Capabilitie of ImageUpload HOT 1
- geolocation error - disabled by default (feature request) HOT 6
- tsconfig parsing breaks if you include any comments HOT 1
- The 'Show DatavView' button does not work HOT 2
- Tutorial on creating an R-powered Power BI visual is not updated HOT 5
- API Dialog box HOT 7
- pbiviz package -> [ERR_REQUIRE_ESM]: require() of ES Module HOT 7
- Total and Subtotal API not working with select-for-in expression in the data view mapping of the matrix object
- powerbi-client + custom visual. Setting border value HOT 5
- [>= 5.4.2] Uncaught ReferenceError: global is not defined HOT 2
- Custom Visual Library Support for Open AI in Power BI Web HOT 2
- Deprecated modules (dependencies?) when install powerbi-visuals-tools globally HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from powerbi-visuals-tools.