<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Akshay Ram Vignesh on Medium]]></title>
        <description><![CDATA[Stories by Akshay Ram Vignesh on Medium]]></description>
        <link>https://medium.com/@akshay5995?source=rss-d57ca62466a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*0Z6JJi8w53ldt08crqVF3A@2x.jpeg</url>
            <title>Stories by Akshay Ram Vignesh on Medium</title>
            <link>https://medium.com/@akshay5995?source=rss-d57ca62466a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 09:47:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@akshay5995/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[JavaScript, The Beast Within ]]></title>
            <link>https://medium.com/@akshay5995/javascript-the-beast-within-d0e366ba0781?source=rss-d57ca62466a------2</link>
            <guid isPermaLink="false">https://medium.com/p/d0e366ba0781</guid>
            <category><![CDATA[es6]]></category>
            <category><![CDATA[ecmascript]]></category>
            <category><![CDATA[js]]></category>
            <category><![CDATA[getting-started]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Akshay Ram Vignesh]]></dc:creator>
            <pubDate>Mon, 27 Aug 2018 04:54:44 GMT</pubDate>
            <atom:updated>2018-08-27T05:38:24.771Z</atom:updated>
            <cc:license>http://creativecommons.org/licenses/by/4.0/</cc:license>
            <content:encoded><![CDATA[<p>Just the <em>tip</em> of the iceberg ❄️</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ksoSkcc1UlPAXA0REMyfWA.png" /><figcaption>JavaScript I know (on the surface) vs. JavaScript I don’t know (what lies underneath)</figcaption></figure><p>I was amused by <strong>JavaScript</strong> ever since I saw the things that can be done using it and the ease, with what we can achieve such things. I’ve been working with <a href="https://reactjs.org/">React JS</a> and <a href="https://nodejs.org/en/">Node JS</a> for almost a year and a half now. Needless to say, I’m a big React fanboy.</p><p>Recently, I’ve started to understand what’s really going on under the hood and behind all those layers of abstraction presented to us as developers. This revelation has made go back to basics and understand workings of JavaScript in detail 😲</p><p>Every time I look back at all the work I’ve achieved with JS without knowing really anything about its inner workings is really amusing to me. Please, take that as an <strong>ode</strong> to the JavaScript community. You guys are <strong>amazing</strong> 🙌</p><blockquote><em>Note: In this article, I hope to cover </em>introduction<em> to JS and </em>4 topics/ features<em> that intrigued me about </em>JavaScript<em> and made me an avid reader of </em><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript"><strong><em>MDN Web Docs</em></strong></a><em> and other JS related articles. It’ll be useful for folks just getting started with JS or, it’ll act as a refresher for the experienced.</em></blockquote><p>I hope you too get <em>inspired</em> to understand this <em>mysterious</em> world of JavaScript 🌎 (or, just learn something new 😉).</p><p>Here’s a little introduction to JS from my personal <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/A_re-introduction_to_JavaScript">favourite</a>.</p><p>1. JavaScript is notorious for being the <a href="http://crockford.com/javascript/javascript.html"><strong>world’s most misunderstood programming language</strong></a></p><p>2. It is often derided as being a toy, but beneath its layer of deceptive simplicity, powerful language features <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await"><strong>await</strong></a>.( <em>Async pun, eh ? </em>😜 )</p><p>3. JavaScript is now used by an incredible number of high-profile applications, showing that deeper knowledge of this technology is an important skill for any web or mobile developer.</p><p>Unlike most programming languages, the JavaScript language has no concept of input or output. It is designed to run as a scripting language in a host environment, and it is up to the host environment to provide mechanisms for communicating with the outside world.</p><p>Host environment is usually a <strong>browser</strong>.</p><p>JavaScript interpreters can also be found in a huge list of other places, including Adobe Photoshop, SVG images, server-side environments such as Node.js, NoSQL databases like the open source Apache CouchDB, embedded computers, complete desktop environments like GNOME (one of the most popular GUIs for GNU/Linux operating systems), etc.</p><p>JavaScript is a multi-paradigm, dynamic language with types and operators, standard built-in objects, and methods. Its syntax is based on the Java and C languages — many structures from those languages apply to JavaScript as well.</p><blockquote>I’ll also point you to some articles, if you wish to read more. These can be features of ES6 or it’s predecessors.</blockquote><h4>What’s with the name ?</h4><p><em>or, What’s ECMAScript ?</em></p><p><strong>JavaScript</strong> was created in 1995 by Brendan Eich (Netscape Engineer). It was originally named <strong>Mocha</strong> and was changed to be called <strong>LiveScript</strong>, but it was renamed after a marketing decision that attempted to capitalise on the popularity of Java language at that point in time.</p><p>Netscape submitted <strong>JavaScript</strong> to ECMA (a European standards organisation), it resulted in the first edition of the <a href="https://developer.mozilla.org/en-US/docs/Glossary/ECMAScript"><strong>ECMAScript</strong></a> standard that year.</p><p>The standard received a significant update as <a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">ECMAScript edition 3</a> in 1999, and it has stayed pretty much stable ever since.</p><p>The fourth edition was abandoned, due to political differences concerning language complexity.</p><p>Many parts of the fourth edition formed the basis for ECMAScript edition 5, published in December of 2009, and for the 6th major edition of the standard, published in June of 2015.</p><p>So conclusion, I believe <strong>JavaScript</strong> is considered the Language which implements a standard called <strong>ECMAScript</strong>.</p><blockquote>JavaScript is the implementation of the standard that is, ECMAScript.</blockquote><blockquote><strong>Sources</strong>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/A_re-introduction_to_JavaScript">A_re-introduction_to_JavaScript</a>, <a href="https://stackoverflow.com/questions/912479/what-is-the-difference-between-javascript-and-ecmascript">what is the difference between JavaScript and ECMAscript</a></blockquote><h4><strong>Prototypal Inheritance and </strong>Classes</h4><p><em>One of the most fascinating features for me personally</em></p><p><em>What’s prototypal inheritance you ask ?</em></p><p>JavaScript only has one construct: <strong>objects</strong>. Each object has a private property which holds a link to another object called its <strong>prototype</strong>.</p><p>That prototype object has a prototype of its own, and so on until an object is reached with null as its prototype. By definition, null has no prototype, and acts as the final link in this <strong>prototype chain</strong>.</p><p>Nearly all objects in JavaScript are instances of <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a> which sits on the top of a prototype chain.</p><p>Every object in JS can have another object as its prototype. Then the former object inherits all of latter’s properties.</p><p>An object specifies its prototype via the internal property [[Prototype]]. The chain of objects connected by the [[Prototype]] property is called the prototype chain</p><p>The __proto__ property exposes the internal prototype linkage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/0*sacpzj7gNySk-x8O.png" /><figcaption><strong>Source</strong>: <a href="http://www.javascripttutorial.net/javascript-prototype/">http://www.javascripttutorial.net/javascript-prototype</a></figcaption></figure><p><strong>prototype </strong><em>vs</em><strong> __proto__</strong></p><p>The <strong>prototype</strong> is a property on a constructor function that sets what will become the <strong>__proto__</strong> property on the constructed object.</p><pre>var animal = {<br>  eats: true,<br>  walk() {<br>    console.log(&quot;walking!!&quot;);<br>  }<br>};<br><br>var rabbit = {<br>  jumps: true,<br>  __proto__: animal<br>};</pre><pre>var bugsBunny = {<br>    likesEating: &#39;Cartoon Carrots&#39;,<br>    isCartoon: true,<br>    __proto__: rabbit<br>};</pre><pre>bugsBunny.walk(); // walking!!! <br>// resolved by going up the prototype chain to &#39;animal&#39;</pre><pre>console.log(bugsBunny.jumps); // true<br>// resolved by going up the prototype chain to &#39;rabbit&#39;</pre><p><em>Now, tell me about </em><strong><em>classes</em></strong><em> ?</em></p><p><em>Okay</em>, Now classes in JavaScript are just <strong>syntactic sugar</strong> on top of it’s prototypal inheritance.( Making prototypal inheritance more <strong>classy </strong>for all OOPs people out there 😅)</p><p>ES6 introduced a new set of keywords implementing <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes">classes</a>. i.e, <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/class">class</a>, <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/constructor">constructor</a>, <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/static">static</a>, <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/extends">extends</a>, and <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/super">super</a></p><p>I’m gonna let you take it from here to<em> find out </em>more about classes👆.</p><blockquote>Sources: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes">Classes</a>, I<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Inheritance_and_the_prototype_chain">nheritance and Prototypal Chain</a></blockquote><h4>What is “this “ ?</h4><p><em>Spoiler: it’s just spell </em><strong><em>binding</em></strong></p><p><strong>this </strong>behaves a little differently in JavaScript compared to other languages. It also has some differences between strict and non-strict mode in Javascript.</p><p>The value of <strong>this</strong> is determined by how a function is called.It can’t be set by assignment during execution, and it may be different each time the function is called.</p><p><strong>Global Context</strong>:</p><p>In non-strict mode by default <strong>this</strong> points to the global window object in browser, and in strict mode by default <strong>this</strong> is <strong>undefined.</strong></p><pre>In browser<br>console.log(this === window); //true</pre><pre>In Node<br>console.log(this === global); //true</pre><pre>&#39;use strict&#39;<br>console.log(this); //undefined</pre><p><strong>Function Context</strong>:</p><p>The value of this remains at whatever it was set to when entering the execution context.</p><p>To pass the value of this from one context to another, use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/call">call</a>, or <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply">apply</a><strong>:</strong></p><pre>var obj1 = { a: &#39;Custom&#39; };</pre><pre>var a = &#39;Global&#39;;</pre><pre>function whatIsA() {<br>   return this.a;<br>}</pre><pre>console.log(whatIsA()); //Global<br>console.log(whatIsA().call(obj1)); //Custom</pre><p><strong>Bind():</strong></p><p>ES5 introduced a new function for Function.prototype called the bind().</p><p>Calling func.bind(someObject)creates a new function with the same body and scope as func, but where this occurs in the original function, in the new function it is permanently bound to the first argument of bind</p><pre>// function WhatIsA from the above example</pre><pre>var obj2 = { a: &#39;I&#39;m Object 2’s a!&#39; };</pre><pre>var whatIsAInObj2 = whatIsA.bind(obj2);</pre><pre>console.log(whatIsAInObj2()); // I&#39;m Object 2’s a!</pre><p><strong>Arrow Functions</strong>:</p><p>With the introduction of arrow functions this retains the value of the enclosing lexical context’s this.</p><pre> var obj = {<br>             bar: function() {<br>                   var x = () =&gt; this;<br>                   return x;<br>               }<br>         };</pre><pre>var fn = obj.bar();</pre><pre>console.log(fn() === obj); // true</pre><p>I<em> can keep going.But, for more on </em><strong><em>this </em></strong><em>take a look at the </em><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this"><em>MDN Docs</em></a><em>. </em>😉</p><blockquote>Read about how <strong>this</strong> binding is only affected by the most immediate member reference.</blockquote><h4>Hoisting ⬆️</h4><p><em>Up and up and up ? ( Coldplay fans will get it 🎶)</em></p><p>Hoisting came in to picture or specification only with ES6.</p><p>Hoisting was thought up as a general way of thinking about how execution contexts (specifically the creation and execution phases) work in JavaScript.</p><p>A definition of hoisting might suggest that variable and function declarations are physically moved to the top of your code.</p><p>It’s not true , the variable and function declarations are put into memory during the <em>compile</em> phase, but stay exactly where you typed them in your code.</p><pre>console.log(sayHello(&#39;world!&#39;)); // Hello world!<br>console.log(a); <br>// undefined and not &#39;ReferenceError&#39; due to hoisting <br>console.log(sayOla(&#39;world!&#39;)); <br>// TypeError: sayOla is not a function</pre><pre>function sayHello(param) {<br>   return &#39;Hello &#39; + param;<br>}</pre><pre>var a = 1;</pre><pre>var sayOla = function (param) {<br>   return &#39;Hello &#39; + param;<br>};</pre><p>Above example shows hoisting in action.</p><p>Conceptually, how your run time sees it is.</p><pre>function sayHello(param) {<br>   return &#39;Hello &#39; + param;<br>}</pre><pre>var a;<br>var sayOla;</pre><pre>console.log(sayHello(&#39;world!&#39;)); // Hello world!<br>console.log(a); <br>// undefined and not &#39;ReferenceError&#39; due to hoisting<br>console.log(sayOla(&#39;world!&#39;)); <br>// TypeError: sayOla is not a function</pre><pre>a = 1;<br>sayOla = function (param) {<br>   return &#39;Hello &#39; + param;<br>};</pre><blockquote>Note: only declarations are hoisted but not assignments. also, class declarations are not hoisted.</blockquote><p><strong><em>Read more</em></strong><em>: </em><a href="https://stackoverflow.com/questions/35537619/why-are-es6-classes-not-hoisted"><em>Why are ES6 classes not hoisted</em></a></p><h4>Now, Let’s bring it to a “Closure” 🔚</h4><p><em>Another JS pun </em>😉</p><p>A <strong>closure</strong> is the function bundled together (enclosed) with references to its surrounding state (the <strong>lexical environment</strong>).</p><p>Closure gives you access to an outer function’s scope from an inner function. In JavaScript, closures are created every time a function is created, at function creation time.</p><pre>function outerFunction() {<br>    var x = &#39;Hello &#39;;<br>    return function (param) {<br>       return x + param;<br>    }<br>}</pre><pre>var newFunc = outerFunction();</pre><pre>console.log(newFunc(&#39;World!&#39;)); // Hello World!</pre><pre>// Even after returning the function has access to variable x</pre><p>Closures are usually used to give objects data privacy and to fix order of partial application of functions.</p><pre>// partial application</pre><pre>function makeAdder(x) {<br>  return function(y) {<br>    return x + y;<br>  };<br>}<br><br>var add5 = makeAdder(5);</pre><pre>console.log(add5(10)); // 15</pre><p><strong><em>Read More</em></strong><em>: </em><a href="https://stackoverflow.com/questions/2728278/what-is-a-practical-use-for-a-closure-in-javascript"><em>Practical use of Closure</em></a><em>, </em><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Closures"><em>Closures</em></a></p><p>I hope this article got you <em>inspired</em> or <em>curious</em> to learn more about JavaScript.😄</p><p>PS: I’ll just leave you with my personal favourite JS articles/ docs 💌</p><ol><li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/A_re-introduction_to_JavaScript">A re-Introduction to JavaScript</a></li><li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/EventLoop">Event Loop</a></li><li>C<a href="https://medium.com/javascript-scene/curry-or-partial-application-8150044c78b8?source=bookmarks---------37----------------">urry or Partial Application</a></li><li><a href="https://codeburst.io/all-about-javascript-functions-in-1-article-49bfd94b31ab">All About JavaScript functions</a></li><li><a href="https://medium.com/javascript-scene/master-the-javascript-interview-what-is-functional-programming-7f218c68b3a0">Functional Programming JS</a></li><li><a href="https://medium.com/javascript-scene/master-the-javascript-interview-what-s-the-difference-between-class-prototypal-inheritance-e4cd0a7562e9">Class and Prototypal Inheritance</a></li></ol><p>You can also follow this really interesting Y<a href="https://www.youtube.com/channel/UCO1cgjhGzsSYb1rsB4bFe4Q">ouTube channel</a> for cool JS related stuff and more .</p><p>I’ll keep adding to this list more as I go through this incredible adventure of trying to understand this <em>powerful</em> yet, <em>mysterious</em> landscape of <strong>JavaScript</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*6RYjeazCE3_YLMIQ.gif" /></figure><p>Please , 👏 if you liked the article. <strong>Thank you</strong> for your time. 🙏</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d0e366ba0781" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How To Embed Microsoft Power BI Charts Into Your React Application]]></title>
            <link>https://medium.com/@akshay5995/how-to-embed-microsoft-powerbi-charts-into-your-react-application-a3078edf5dc6?source=rss-d57ca62466a------2</link>
            <guid isPermaLink="false">https://medium.com/p/a3078edf5dc6</guid>
            <category><![CDATA[dahboard]]></category>
            <category><![CDATA[microsoft]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[power-bi]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Akshay Ram Vignesh]]></dc:creator>
            <pubDate>Sun, 12 Aug 2018 18:00:49 GMT</pubDate>
            <atom:updated>2020-04-26T15:00:49.476Z</atom:updated>
            <cc:license>https://creativecommons.org/licenses/by-nc-sa/4.0/</cc:license>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EfvMR3OMx8uGrjOQcvOcIA.jpeg" /></figure><blockquote><em>Note: This article is updated for the latest release of the package </em><strong><em>≥2.0.0</em></strong></blockquote><p>Embedding Microsoft Power BI charts into your React Application can be breeze with the right tools. Be it Report, Dashboard or a Tile.</p><p>This article assumes you have a fairly decent idea about Microsoft Power BI and few related terminologies.</p><h3>TL;DR</h3><p>If you’re using <em>npm</em></p><pre>npm i powerbi-report-component</pre><p>or <em>yarn</em></p><pre>yarn add powerbi-report-component</pre><p>Basic usage for Report, Dashboard or Tile.</p><pre>import { Report } from &#39;powerbi-report-component&#39;;</pre><pre>&lt;Report<br>  tokenType=&quot;Embed&quot; // or, &quot;Aad&quot;<br>  accessToken=&quot;&quot; // accessToken goes here<br>  embedUrl=&quot;&quot; // embedUrl goes here<br>  embedId=&quot;&quot; // report or dashboard Id goes here<br>  pageName=&quot;&quot; // set as current page of the report<br>  reportMode=&quot;view&quot; // options: view/edit/create<br>  permissions=&quot;All&quot; // View<br>  style={reportStyle}<br>/&gt;</pre><pre>import { Dashboard } from &#39;powerbi-report-component&#39;;</pre><pre>&lt;Dashboard<br>  tokenType={tokenType}<br>  accessToken={accessToken}<br>  embedUrl={embedUrl}<br>  embedId={embedId}<br>  style={dashboardStyle}<br>  pageView=&quot;fitToWidth&quot; // &#39;oneColumn&#39;, &#39;actualSize&#39;<br>/&gt;</pre><pre>import { Tile } from &#39;powerbi-report-component&#39;;</pre><pre>&lt;Tile<br>  tokenType={tokenType}<br>  accessToken={accessToken}<br>  embedUrl={embedUrl}<br>  embedId={embedId}<br>  dashboardId={dashboardId}<br>  style={tileStyle}<br>/&gt;</pre><blockquote>Note: I’d like to have some of you as collaborators to improve and maintain it.Raise a PR anytime.</blockquote><h3>Now, for the those who stayed :)</h3><p>Embedding a Power BI report into your React Application can be a pain for a beginner. Even though the Microsoft’s documentation on the topic is pretty neat.</p><p>I’m just gonna tell you what’s need from a React developer’s perspective and not go into the details of implementation or architecture.</p><p>There are two approaches that you can take to embed your Power BI Report:</p><ol><li>User Owns Data</li><li>App Owns Data</li></ol><p><strong>The main difference is:</strong></p><ul><li><strong>User Owns Data</strong> sample is for <a href="https://powerbi.microsoft.com/en-us/documentation/powerbi-developer-embedding/">Embedding for your organisation</a>, the embedded reports readers can be Power BI Pro or free users in your organisation. Users have to log-in with their PBI account. <a href="https://powerbi.microsoft.com/en-us/documentation/powerbi-premium/"><strong>Power BI Premium</strong></a><strong> </strong>license is required. (i.e, Users who are part of your AD)</li><li><strong>App Owns Data</strong> sample is for <a href="https://powerbi.microsoft.com/en-us/documentation/powerbi-developer-embedding/">Embedding for your customers</a>, the embedded report readers can be your own customers(say you’re an ISV application provider). So no log-in. <a href="https://powerbi.microsoft.com/en-us/blog/power-bi-embedded-capacity-based-skus-coming-to-azure/"><strong>Power BI Embedded</strong></a> license is required.(i.e, Users outside your AD)</li></ul><blockquote>source: <a href="https://community.powerbi.com/t5/Developer/App-vs-User-Owns-Data/td-p/300729">https://community.powerbi.com/t5/Developer/App-vs-User-Owns-Data/td-p/300729</a></blockquote><p>You have to choose who will be using your application that’s gonna contain your embedded report i.e, Internal users(AD User) vs. External users(Non AD).</p><p>Now that you’ve decided on which approach you’re gonna choose.</p><p>Hopefully, You have your report ready and are able to view it in <a href="https://powerbi.microsoft.com/">https://powerbi.microsoft.com</a>.</p><p>Now, navigate to your report under your workspaces your URL should look something like this:</p><blockquote><em>https://app.powerbi.com/groups/</em><strong><em>&lt;workspace-id&gt;</em></strong><em>/reports/</em><strong><em>&lt;report-id&gt;</em></strong></blockquote><p>for dashboards you might have something like this:</p><blockquote><em>https://app.powerbi.com/groups/</em><strong><em>&lt;workspace-id&gt;</em></strong><em>/dashboards/</em><strong><em>&lt;dashboard-id&gt;</em></strong></blockquote><p>To Embed your report you’ll need the following:</p><p><strong>Report ID</strong>: from the URL. 👆</p><p><strong>Workspace ID</strong>: also, from the URL. 👆</p><p><strong>Token</strong>: AAD or Embed Token (To authenticate the person accessing the report)</p><p><em>Note: AAD token is used while taking the </em><strong><em>User Owns Data</em></strong><em> Approach and Embed token is used when taking </em><strong><em>App Owns Data</em></strong><em> Approach.</em></p><p><em>I’ll talk about ways to generate AAD and Embed token in my next article.</em></p><p><strong>Embed Url</strong>: (Will consist of Report ID and Workspace ID)</p><blockquote><a href="https://app.powerbi.com/reportEmbed?reportId=8a5b15cc-e026-4d5d-94c0-db5091d65614&amp;groupId=be8908da-da25-452e-b220-163f52476cdd">https://app.powerbi.com/reportEmbed?reportId=&lt;report-id&gt;&amp;groupId=</a>&lt;workspace-id&gt;</blockquote><p>There are mainly two ways you can proceed with embedding the report into your react application.</p><ol><li>Using an iframe</li><li>Using Power BI JS API provided by Microsoft</li></ol><p>Using an iframe is pretty straightforward but, this doesn’t provide the flexibility that a React component would provide, like callbacks or event triggers.</p><p>Embedding iframe would something like this:</p><pre>&lt;iframe <br>  width=”800&quot; <br>  height=”600&quot;<br>  src=”http://myserver/reports/powerbi/Sales?rs:embed=true&quot;<br>  allowFullScreen=”true”&gt;<br>&lt;/iframe&gt;</pre><p>But, naturally as Javascript developers we tend to go with the more flexible JS API.</p><p>You can take a look at Microsoft’s official page:</p><blockquote><a href="https://microsoft.github.io/PowerBI-JavaScript/demo/v2-demo/index.html#">https://microsoft.github.io/PowerBI-JavaScript/demo/v2-demo/index.html#</a></blockquote><p>They have a very clear explanation and demo in Vanilla JS which uses their Javascript API.</p><blockquote><a href="https://microsoft.github.io/PowerBI-JavaScript/demo/v2-demo/index.html#">https://microsoft.github.io/PowerBI-JavaScript/demo/v2-demo/index.html#</a></blockquote><p>You might be wondering, the demo is in Vanilla JS so if I have to make it a React Component and use it in my app.hmm, that might take a while 🤔</p><blockquote>powerbi-report-component to the rescue! ✨</blockquote><p><em>Check it out</em> <a href="https://www.npmjs.com/package/powerbi-report-component">https://www.npmjs.com/package/powerbi-report-component</a>. (<em>It’s fairly easy to use :) )</em></p><p>Install the package using:</p><pre>npm i powerbi-report-component<br>or,<br>yarn add powerbi-report-component</pre><p>Usage for Report,</p><pre>import { Report } from &#39;powerbi-report-component&#39;;</pre><pre>&lt;Report <br>     tokenType=&quot;Embed&quot; // or &quot;Aad&quot;<br>     accessToken=&quot;&quot; // accessToken goes here<br>     embedUrl=&quot;&quot; // embedUrl goes here<br>     embedId=&quot;&quot; // Report or Dashboard ID goes here<br>     permissions=&quot;All&quot; // or &quot;View&quot;<br>     style={myStyleObject}<br>/&gt;</pre><p><strong>Currently supported features</strong>:</p><ol><li>Custom styling by passing style to your embedded report component.</li><li>The component also lets you pass callbacks to trigger on events like:</li></ol><ul><li>Page Change</li></ul><pre>onPageChange={(data) =&gt; <br>  console.log(`Page name :{data.newPage.displayName}`) <br>}</pre><ul><li>Load</li></ul><pre>onLoad={(report) =&gt; { <br>      console.log(&#39;Report Loaded!&#39;);<br>      this.report = report;<br>// Read docs to know how to use the report object that is returned<br>    }<br>}</pre><ul><li>Data Element Clicked</li></ul><pre>onSelectData={(data) =&gt; <br>  console.log(`You clicked on chart: {data.visual.title}`)<br>}</pre><p>3. Use ‘report’ object returned to parent component for:</p><ul><li>Fullscreen</li></ul><pre>setFullscreen = () =&gt; this.report.fullscreen()</pre><ul><li>Print Report</li></ul><pre>printReport = () =&gt; this.report.print();</pre><ul><li>Change Mode</li></ul><pre>//mode can be &quot;view&quot; or &quot;edit&quot;<br><br> changeMode = (mode) =&gt; this.report.switchMode(mode);</pre><ul><li>Show or Hide Visual Headers</li></ul><pre>toggleAllVisualHeaders = (bool) =&gt; <br>{<br>  const newSettings = {<br>    visualSettings: {<br>      visualHeaders: [<br>        {<br>          settings: {<br>            visible: bool<br>          }<br>        }<br>      ]<br>    }<br>  };</pre><pre>  this.report.updateSettings(newSettings)<br>    .then(function () {<br>      console.log(`Visual header was toggled to {bool}`);<br>    })<br>    .catch(function (errors) {<br>      console.log(errors);<br>    });<br>}</pre><ul><li>Set Filters</li></ul><pre>  //example filter object from Microsoft&#39;s demo page<br><br>    const filter = {<br>      $schema: &quot;http://powerbi.com/product/schema#basic&quot;,<br>      target: {<br>        table: &quot;Store&quot;,<br>        column: &quot;Chain&quot;<br>      },<br>      operator: &quot;In&quot;,<br>      values: [&quot;Lindseys&quot;]<br>    };<br><br>    // using event handlers<br><br>    setFilter = (filter) =&gt;<br>    this.report.setFilters([filter]).catch(function (errors) {<br>        console.log(errors);<br>    });<br><br>    // during load of report<br><br>    onLoad = (report) =&gt; { <br>      report.setFilters([filter]).catch(function (errors) {<br>        console.log(errors);<br>      });<br>      this.report = report;<br>    }<br>  }</pre><ul><li>Get Filters</li></ul><pre>getFilter = () =&gt; <br>    this.report.getFilters().then(function (filters) {<br>        console.log(filters);<br>    }).catch(function (errors) {<br>        console.log(errors);<br>    });</pre><ul><li>Remove Filters</li></ul><pre>removeFilters = () =&gt; <br>  this.report.removeFilters()<br>    .catch(function (errors) {<br>        console.log(errors);<br>  });</pre><ul><li>Save edited report when in “edit” or “create” mode.</li></ul><pre>async saveReport() {<br>if (this.report) {<br> try{<br>    await this.report.save();<br>  } catch (err) {<br>    console.log(&quot;Error saving report&quot;, err);<br>  }<br> }<br>}</pre><p>Usage for Dashboard,</p><pre>import { Dashboard } from &#39;powerbi-report-component&#39;;</pre><pre>&lt;Dashboard<br>  tokenType={tokenType}<br>  accessToken={accessToken}<br>  embedUrl={embedUrl}<br>  embedId={embedId}<br>  style={dashboardStyle}<br>  pageView=&quot;fitToWidth&quot; // &#39;oneColumn&#39;, &#39;actualSize&#39;<br>/&gt;</pre><p>Usage for Tile,</p><pre>import { Tile} from &#39;powerbi-report-component&#39;;</pre><pre>&lt;Tile<br>  tokenType={tokenType}<br>  accessToken={accessToken}<br>  embedUrl={embedUrl}<br>  embedId={embedId}<br>  dashboardId={dashboardId}<br>  style={tileStyle}<br>/&gt;</pre><p>More features coming soon! ⚡️</p><p>Please go over to <a href="https://github.com/akshay5995/powerbi-report-component"><strong><em>README </em></strong></a>in Github for more information.</p><p><strong>Links</strong>:</p><blockquote>Demo<em> site</em>: <a href="http://akshay5995.github.io/powerbi-report-component">http://akshay5995.github.io/powerbi-report-component</a></blockquote><blockquote>GitHub: <a href="https://github.com/akshay5995/powerbi-report-component">https://github.com/akshay5995/powerbi-report-component</a></blockquote><p><strong><em>Sources I found very helpful</em></strong>:</p><p><a href="https://github.com/Microsoft/powerbi-javascript/wiki">Microsoft/PowerBI-JavaScript</a></p><blockquote><a href="https://microsoft.github.io/PowerBI-JavaScript/demo/v2-demo/index.html#">https://microsoft.github.io/PowerBI-JavaScript/demo/v2-demo/index.html#</a></blockquote><p><strong><em>I would love to hear your thoughts and feedback (also any request for new features at </em></strong><a href="https://github.com/akshay5995/powerbi-report-component/issues"><strong><em>https://github.com/akshay5995/powerbi-report-component/issues</em></strong></a><strong><em>).</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a3078edf5dc6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>