Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
I am writing a simple custom visual and i would like to know how i could go about and use moment.js in that visual.
I saw there is a typescript def in the git-repo ->PowerBI-visuals/src/Clients/Typedefs/moment/moment.d.ts
Does that mean that moment.js is avaiable as a common lib, ready to use in custom visuals?
Solved! Go to Solution.
To develop a custom visual, please use the PowerBI Custom Visual CLI Tools. There you could find the tutorial on Adding External Libraries and Installing Typings for Libraries.
@greenelephant Can you share some more info about how you got this working? I added moment 2.18.1 using npm and it appears in my node_modules folder. Moment now comes with it's own type description file, so I added the moment.d.ts file to tsconfig.json:
"files": [ ".api/v1.7.0/PowerBI-visuals.d.ts", "node_modules/moment/moment.d.ts", "src/visual.ts" ]I then added the moment.js file to pbviz.json:
"externalJS": [ "node_modules/moment/min/moment.min.js" ],However, I'm not getting any moment-related namespace in Intellisense.
FYI: This answer on stack overflow solved my namespace problem with moment typings: https://stackoverflow.com/a/42290662/79271
glad you found a solution. Its been a while for me that i worked with powerbi and I cant remember how i made it work now
To develop a custom visual, please use the PowerBI Custom Visual CLI Tools. There you could find the tutorial on Adding External Libraries and Installing Typings for Libraries.
User | Count |
---|---|
8 | |
7 | |
2 | |
2 | |
2 |
User | Count |
---|---|
6 | |
5 | |
4 | |
4 | |
4 |