<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Subbhashit Mukherjee</title>
    <description>The latest articles on DEV Community by Subbhashit Mukherjee (@23subbhashit).</description>
    <link>https://dev.to/23subbhashit</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F260361%2F1cdfc966-e779-4b88-9711-fd0efccba455.jpg</url>
      <title>DEV Community: Subbhashit Mukherjee</title>
      <link>https://dev.to/23subbhashit</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/23subbhashit"/>
    <language>en</language>
    <item>
      <title>Map Visualization In Vue using Leaflet</title>
      <dc:creator>Subbhashit Mukherjee</dc:creator>
      <pubDate>Sat, 26 Sep 2020 13:10:53 +0000</pubDate>
      <link>https://dev.to/23subbhashit/map-visualization-in-vue-using-leaflet-5852</link>
      <guid>https://dev.to/23subbhashit/map-visualization-in-vue-using-leaflet-5852</guid>
      <description>&lt;p&gt;In this post, I will be sharing how to use leaflet in Vue to create map visuals.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;About Leaflet&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Leaflet is the leading open-source JavaScript library for mobile-friendly interactive maps. Weighing just about 39 KB of JS, it has all the mapping features most developers ever need.&lt;/p&gt;

&lt;p&gt;Leaflet is designed with simplicity, performance and usability in mind. It works efficiently across all major desktop and mobile platforms, can be extended with lots of plugins, has a beautiful, easy to use and well-documented API and a simple, readable source code that is a joy to contribute to.&lt;/p&gt;

&lt;p&gt;Here as I am using Vue, I will be using &lt;strong&gt;Vue2Leaflet&lt;/strong&gt;.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Why Leaflet?&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Anyone may ask, why leaflet? &lt;/p&gt;

&lt;p&gt;There are many libraries that can provide help for map visualization in Vue. Some of them are :&lt;br&gt;
1&amp;gt;&lt;strong&gt;vue2-google-maps&lt;/strong&gt;&lt;br&gt;
2&amp;gt;&lt;strong&gt;vue-choropleth&lt;/strong&gt;&lt;br&gt;
3&amp;gt;&lt;strong&gt;MapBox&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The reasons I choose Leaflet  for this article is that:&lt;br&gt;
1&amp;gt;&lt;strong&gt;Leaflet is beginner-friendly:&lt;/strong&gt;&lt;br&gt;
 In Google-maps, we have to make an account on GCP, which is not free (paid). Although Google Maps provide the most number of features, it is not easy to understand in the beginning. Also in choropleth, we have to go through many things to get a simple output.&lt;/p&gt;

&lt;p&gt;2&amp;gt;&lt;strong&gt;No access token to be generated while using it&lt;/strong&gt;:&lt;br&gt;
For using MapBox, we have to get an access token, we don't&lt;br&gt;
have to worry about it in Leaflet.&lt;/p&gt;
&lt;h1&gt;
  
  
  &lt;strong&gt;Installation&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;To install Vue2Leaflet, use this npm command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install vue2-leaflet leaflet --save
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  &lt;strong&gt;Getting Started&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Here is the tree hierarchy of my folder :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;D:.
└───components
    ├───Body
    ├───DataGathering
    ├───Footer
    ├───Header
    ├───HomePage
    │   ├───assets
    │   └───Breads
    ├───MapComponents
    └───Visuals
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, for the Map Visual Purpose only, I will use Body and MapComponents folder Only.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Setting Up&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Before using the functionalities of Leaflet, we have to import some important things in &lt;strong&gt;&lt;u&gt;main.js&lt;/u&gt;&lt;/strong&gt; file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import 'leaflet/dist/leaflet.css';
import { Icon } from "leaflet";

delete Icon.Default.prototype._getIconUrl;

Icon.Default.mergeOptions({
  iconRetinaUrl: require("leaflet/dist/images/marker-icon-2x.png"),
  iconUrl: require("leaflet/dist/images/marker-icon.png"),
  shadowUrl: require("leaflet/dist/images/marker-shadow.png")
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  &lt;strong&gt;Creating the Map component File&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Create a Map Component ( Map.vue ) in the Body folder ( &lt;strong&gt;&lt;u&gt; Body/Map.vue &lt;/u&gt;&lt;/strong&gt; ) and import that component in the App.vue.&lt;/p&gt;

&lt;p&gt;Write this code in that file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;template&amp;gt;
  &amp;lt;div&amp;gt;
  &amp;lt;MapVisual2&amp;gt;&amp;lt;/MapVisual2&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;/template&amp;gt;

&amp;lt;script&amp;gt;
import MapVisual2 from '@/components/MapComponents/MapVisual2'
export default {
  components :{
    MapVisual2,
  }
}
&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  &lt;strong&gt;Creating the visual component for Map-file&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Create a Visual Component ( MapVisual2.vue ) in the MapComponents folder ( &lt;strong&gt;&lt;u&gt; MapComponents/MapVisual2.vue &lt;/u&gt;&lt;/strong&gt; ) and import that component in the Map.vue.&lt;/p&gt;

&lt;p&gt;Code for the component:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;template&amp;gt;
  &amp;lt;div style="height: 80vh"&amp;gt;
    &amp;lt;LMap :zoom="zoom" :center="center"&amp;gt;
      &amp;lt;LTileLayer :url="url"&amp;gt;&amp;lt;/LTileLayer&amp;gt;
      &amp;lt;LMarker :lat-lng="[13.1333682,77.5651881]"&amp;gt;&amp;lt;/LMarker&amp;gt;
      &amp;lt;LMarker :lat-lng="[13.1340669,77.56707]"&amp;gt;&amp;lt;/LMarker&amp;gt;
      &amp;lt;LMarker :lat-lng="[13.1348904,77.5643231]"&amp;gt;&amp;lt;/LMarker&amp;gt;
      &amp;lt;LMarker :lat-lng="[13.1367826,77.5711133]"&amp;gt;&amp;lt;/LMarker&amp;gt;
    &amp;lt;/LMap&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;/template&amp;gt;

&amp;lt;script&amp;gt;
import { LMap, LTileLayer, LMarker } from "vue2-leaflet";
export default {
  name: "Map",
  components: {
    LMap,
    LTileLayer,
    LMarker
  },
  data() {
    return {
      url: "https://{s}.tile.osm.org/{z}/{x}/{y}.png",
      zoom: 16,
      center: [13.1367826,77.5711133],
      bounds: null
    };
  }
};
&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  &lt;strong&gt;Output&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fky3rwq6j0uo939vbs0er.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fky3rwq6j0uo939vbs0er.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Work with Real-Time Data&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;For using this install Axios.&lt;br&gt;
To install Axios, use this command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install axios
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now , in the same Visual component file add this code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;template&amp;gt;
&amp;lt;div&amp;gt;
  &amp;lt;div style="height: 80vh"&amp;gt;
    &amp;lt;LMap  @ready="onReady" @locationfound="onLocationFound" :zoom="zoom" :center="center"&amp;gt;
      &amp;lt;LTileLayer :url="url"&amp;gt;&amp;lt;/LTileLayer&amp;gt;

      &amp;lt;ul&amp;gt;
        &amp;lt;li v-for="(l,i) in latlong" :key="i"&amp;gt;
            &amp;lt;LMarker :lat-lng="l"&amp;gt;&amp;lt;/LMarker&amp;gt;
        &amp;lt;/li&amp;gt;
      &amp;lt;/ul&amp;gt;


    &amp;lt;/LMap&amp;gt;

  &amp;lt;/div&amp;gt;
  &amp;lt;br/&amp;gt;
    &amp;lt;br/&amp;gt;

  &amp;lt;/div&amp;gt;

&amp;lt;/template&amp;gt;

&amp;lt;script&amp;gt;
//import L from 'leaflet';
import { LMap, LTileLayer, LMarker } from "vue2-leaflet";
const axios = require("axios");
export default {
  name: "Map",
  components: {
    LMap,
    LTileLayer,
    LMarker
  },
  data() {
    return {
      url: "https://{s}.tile.osm.org/{z}/{x}/{y}.png",
      zoom: 2,
      center: [13.1367826,77.5711133],
      bounds: null,
      results : null,
      country : [],
      latlong : [],
      confirmed : [],
    };
  },
  methods: {
onReady (mapObject) {
  mapObject.locate();
},
onLocationFound(location){
  console.log(location)
}
},
created() {
    axios.get("https://corona.lmao.ninja/v2/jhucsse")
    .then(r =&amp;gt; r["data"])
    .then(data =&amp;gt; {
        for(var i=0;i&amp;lt;742;i++){
            if(data[i].country in this.country){
                continue
            }
            else{

                if(data[i].coordinates["latitude"]!=null &amp;amp;&amp;amp; data[i].coordinates["longitude"]!=null){
                    var a=[]
                    this.country.push(data[i].country)
                    a.push(parseFloat(data[i].coordinates["latitude"]))
                    a.push(parseFloat(data[i].coordinates["longitude"]))
                    this.confirmed.push(data[i].stats["confirmed"])
                    console.log(data[i].country)
                    console.log(data[i].coordinates["latitude"])
                    console.log(data[i].coordinates["longitude"])
                    console.log(data[i].stats["confirmed"])
                    this.latlong.push(a)
                }
            }


  }
  console.log(this.latlong)
    }

  )
}
};
&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  &lt;strong&gt;Output&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fes46tlj5f1rxmxasg27r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fes46tlj5f1rxmxasg27r.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;center&gt;&lt;h1&gt;That's the End&lt;/h1&gt;&lt;/center&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.gifer.com%2Forigin%2F46%2F46eae4c4ff91c03514a7096538740b42_w200.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.gifer.com%2Forigin%2F46%2F46eae4c4ff91c03514a7096538740b42_w200.gif"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>vue</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Fetching and Visualizing Data in Vue using Axios and Chart.js</title>
      <dc:creator>Subbhashit Mukherjee</dc:creator>
      <pubDate>Thu, 27 Aug 2020 15:51:37 +0000</pubDate>
      <link>https://dev.to/23subbhashit/fetching-and-visualizing-data-in-vue-using-axios-and-chart-js-k2h</link>
      <guid>https://dev.to/23subbhashit/fetching-and-visualizing-data-in-vue-using-axios-and-chart-js-k2h</guid>
      <description>&lt;h1&gt;
  
  
  &lt;strong&gt;INTRODUCTION&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;First of all, this will be my first article :), please do support and follow me for more.&lt;br&gt;
I am making a COVID19Tracker of my own and came across something called API. A quick  intro for  API:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;An application program interface (API) is a set of routines, protocols, and tools for building software applications.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Basically, an API specifies how software components should interact.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Additionally, APIs are used when programming graphical user interface (GUI) components.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A good API makes it easier to develop a program by providing all the building blocks. A programmer then puts the blocks together.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  &lt;strong&gt;GETTING STARTED&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;This was my file structure:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;D:.
└───components
    ├───Body
    ├───DataGathering
    ├───Footer
    ├───Header
    ├───HomePage
    │   ├───assets
    │   └───Breads
    ├───Maps
    └───Visuals
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I will be focusing only on working of Axios and Chart.js&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;To install axios and chart.js:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install chart.js --save
npm install axios
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;To use them:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import Chart from 'chart.js';
const axios = require("axios");
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;DATA FETCHING&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Create a Component named as Cases.vue in &lt;u&gt;Body/Cases.vue&lt;/u&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;template&amp;gt;
&amp;lt;div&amp;gt;
    &amp;lt;br&amp;gt;
    &amp;lt;br&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;CaseBread&amp;gt;&amp;lt;/CaseBread&amp;gt;
        &amp;lt;hr/&amp;gt;
        &amp;lt;br&amp;gt;
        &amp;lt;h2&amp;gt;Cases&amp;lt;/h2&amp;gt;
        &amp;lt;CasesLine
        :label="labels"
        :chart-data="confirmed" 
        &amp;gt;&amp;lt;/CasesLine&amp;gt;
        &amp;lt;br&amp;gt;
        &amp;lt;br&amp;gt;
        &amp;lt;CasesBar
        :label="labels"
        :chart-data="confirmed" 
        &amp;gt;&amp;lt;/CasesBar&amp;gt;
        &amp;lt;br&amp;gt;
        &amp;lt;br&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;/template&amp;gt;

&amp;lt;script&amp;gt;
const axios=require("axios")
import CasesBar from '@/components/Visuals/CasesBar'
import CasesLine from '@/components/Visuals/CasesLine'
import CaseBread from '@/components/HomePage/Breads/CaseBread'
export default {
     data : ()=&amp;gt; {
        return {
            labels : [],
            confirmed : [],
        }

    },
    components : {
        CasesLine,
        CasesBar,
        CaseBread
    },
    async created() {
  const { data } = await axios.get("https://covid19.mathdro.id/api/confirmed");
  var c=0
  for(var i=0;i&amp;lt;1000;i++){
    if(data[i].countryRegion=="India"){
            if (data[i].provinceState in this.labels){
              continue
            }
            else{
              this.labels.push(data[i].provinceState)
              this.confirmed.push(data[i].confirmed)
              c=c+1
              if(c==28){
                break
              }
            }
          }
  }
console.log(this.labels)
}   
}
&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Note:&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Do remove the CasesBread and all of it's related elements while copying this. &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;So what does it do?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Under the asynchronous lifecycle method called "created" in vue, it fetches data from API:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; https://covid19.mathdro.id/api/confirmed 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and passes it to the components CasesLine and CasesBar.These two components use two props, label and chart. Label is an array that will contain the fetched state names and the corresponding cases and chart is an array containing the corresponding cases in each state.&lt;/p&gt;

&lt;p&gt;To fetch an API, use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;axios.get("YOUR_API");
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  &lt;strong&gt;MAKING CHARTS&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Here I will be discussing two types of charts,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Line Chart&lt;/li&gt;
&lt;li&gt;Bar Chart&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Line Chart&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;To create a line chart, create a file called CasesLine.vue in &lt;u&gt;Visuals/CasesLine.vue&lt;/u&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;template&amp;gt;
  &amp;lt;canvas ref="myChart" width="900px" height="250px"&amp;gt;&amp;lt;/canvas&amp;gt;
&amp;lt;/template&amp;gt;

&amp;lt;script&amp;gt;
import Chart from 'chart.js';
export default {
  props: {
    label: {
      type: Array
    },
    chartData: {
      type: Array
    },
  },
  aysnc mounted() {
    await new Chart(this.$refs.myChart, {
      type: 'line',
      data: {
        labels: this.label,
        datasets: [
        {
            label: 'CASES',
            borderColor: 'rgba(245, 229, 27, 1)',
            backgroundColor: 'rgba(255, 236, 139,0.2)',
            data: this.chartData,
        }
        ]
      },
      options: {
    scales: {
      yAxes: [{
        ticks: {
          beginAtZero: true
        }
      }]
    }
    }
    });
  }
}
&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Procedure:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a canvas for it in the template tag with a defined ref.&lt;/li&gt;
&lt;li&gt;Define two props label and chartdata.&lt;/li&gt;
&lt;li&gt;Under the mounted lifecycle method in Vue, create a new Chart and use the ref.&lt;/li&gt;
&lt;li&gt;Define type of chart as line&lt;/li&gt;
&lt;li&gt;Pass the props to the datasets and labels in the Chart&lt;/li&gt;
&lt;li&gt;Your Chart is ready&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Result:&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fdy5qcl61k0ef4tgyenpk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fdy5qcl61k0ef4tgyenpk.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Bar Chart&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;To create a bar chart, create a file called CasesBar.vue in &lt;u&gt;Visuals/CasesBar.vue&lt;/u&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;template&amp;gt;
  &amp;lt;canvas ref="myChart" width="900px" height="250px"&amp;gt;&amp;lt;/canvas&amp;gt;
&amp;lt;/template&amp;gt;

&amp;lt;script&amp;gt;
import Chart from 'chart.js';
export default {
  props: {
    label:  {
      type: Array
    },
    chartData:  {
      type: Array
    }
  },
  async mounted() {
    await new Chart(this.$refs.myChart, {
      type: 'bar',
      data: {
        labels: this.label,
        datasets: [
        {
            label: 'CASES',
            backgroundColor: 'rgba(144,238,144 , 0.9 )',
            data: this.chartData,
        }
        ]
      },
      options: {
    scales: {
      yAxes: [{
        ticks: {
          beginAtZero: true
        }
      }]
    }
    }
    });
  }
}
&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Procedure:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;All the points are the same as linechart , except the point that here type should be bar.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Result:&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fodm6s5pvmu0bzsrm6iui.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fodm6s5pvmu0bzsrm6iui.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;THAT'S THE END&lt;/strong&gt;
&lt;/h1&gt;

&lt;center&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdl9.glitter-graphics.net%2Fpub%2F3366%2F3366289nltlt6b3eh.gif"&gt;&lt;/center&gt;

</description>
      <category>vue</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
