<?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: Omkar Bhoir</title>
    <description>The latest articles on DEV Community by Omkar Bhoir (@omkar_bhoir).</description>
    <link>https://dev.to/omkar_bhoir</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%2F679745%2F6ad52766-0d20-4738-a05a-ddace612e83c.png</url>
      <title>DEV Community: Omkar Bhoir</title>
      <link>https://dev.to/omkar_bhoir</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/omkar_bhoir"/>
    <language>en</language>
    <item>
      <title>How to Create Powerful Visualizations Easily using Apache Echarts and React</title>
      <dc:creator>Omkar Bhoir</dc:creator>
      <pubDate>Fri, 22 Jul 2022 09:42:19 +0000</pubDate>
      <link>https://dev.to/playfulprogramming/how-to-create-powerful-visualizations-easily-using-apache-echarts-and-react-47l9</link>
      <guid>https://dev.to/playfulprogramming/how-to-create-powerful-visualizations-easily-using-apache-echarts-and-react-47l9</guid>
      <description>&lt;p&gt;&lt;strong&gt;&lt;em&gt;Data is Oil use it well&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;In today's world Visualization is one of the most effective and performant ways of concluding data. A person can efficiently perform analysis on a Pie Chart instead of a Spreadsheet.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Let's say you have a vast amount of data about the users of your software, but it is of no use if you cannot draw insights from that raw data that can help you take better business decisions, to be more precise “Data-Driven Decisions”. Enough of context guys, let us start with the main aim of this article which is to get you started with Apache Echarts in React&lt;/p&gt;




&lt;h2&gt;
  
  
  An Introduction to Apache Echarts
&lt;/h2&gt;

&lt;p&gt;ECharts is a powerful, easy-to-use, and flexible JavaScript Visualization Library. Apache Echarts describes itself on &lt;a href="https://www.npmjs.com/package/echarts" rel="noopener noreferrer"&gt;npm&lt;/a&gt; as follows:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Apache ECharts is a free, powerful charting and visualization library offering an easy way of adding intuitive, interactive, and highly customizable charts to your commercial products. It is written in pure JavaScript and based on &lt;a href="https://github.com/ecomfe/zrender" rel="noopener noreferrer"&gt;zrender&lt;/a&gt;, which is a whole new lightweight canvas library.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The above description is enough to know what ECharts is doing, right 🤔? Today it has around 480k weekly downloads on npm. 51.5k stars on &lt;a href="https://github.com/apache/echarts" rel="noopener noreferrer"&gt;Github&lt;/a&gt; and the latest version is 5.3.3 which was published just 12 days ago.&lt;/p&gt;




&lt;h2&gt;
  
  
  Echarts For React
&lt;/h2&gt;

&lt;p&gt;Remember Apache ECharts is a JavaScript library. &lt;a href="https://www.npmjs.com/package/echarts-for-react" rel="noopener noreferrer"&gt;echarts-for-react&lt;/a&gt; is a React wrapper for ECharts.&lt;/p&gt;

&lt;h2&gt;
  
  
  Start using Echarts in your React Project
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Step 1&lt;/strong&gt;: Create a react app using your favorite tool (CRA or Vite) or create one from scratch&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2&lt;/strong&gt;: Run npm install echarts and npm install echarts-for-react&lt;/p&gt;

&lt;p&gt;Now you have everything to get started with ECharts&lt;/p&gt;

&lt;p&gt;For creating charts the main thing you should know is the options object. This object contains data that ECharts require to render a chart perfectly. Below is a glance at what you can include in the options object. For further options have a look here &lt;a href="https://echarts.apache.org/en/option.html" rel="noopener noreferrer"&gt;https://echarts.apache.org/en/option.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fceexn9qvmidr1qulk1ah.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fceexn9qvmidr1qulk1ah.png" alt="Echarts Option" width="292" height="654"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Simple Bar Chart using Echarts
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Step 1&lt;/strong&gt;: First we need to import the echarts-for-react package (as ReactEChart)into our file. I have created a separate file named BarChart.jsx&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import ReactEChart from "echarts-for-react";
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 2&lt;/strong&gt;: We need to create an empty eChartsOption object, and then use the ReactEChart component and pass the created object to the option prop of the ReactEChart Component&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import ReactEChart from "echarts-for-react";

export default function BarChart() {
    const eChartsOption {};
    return (
        &amp;lt;div&amp;gt;
           &amp;lt;ReactEChart option±{eChartsOption} /&amp;gt;
        &amp;lt;/div&amp;gt;
    );
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 3&lt;/strong&gt;: Now, we will add the required data to the **eChartsOption **object.&lt;/p&gt;

&lt;p&gt;The main ones to be included in the object are &lt;strong&gt;xAxis&lt;/strong&gt;, &lt;strong&gt;yAxis&lt;/strong&gt;, and &lt;strong&gt;series&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;xAxis&lt;/strong&gt;: this contains the data for the x-axis on the chart.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;yAxis&lt;/strong&gt;: this contains the data for the y-axis on the chart.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;series&lt;/strong&gt;: this contains the data for drawing the chart. Like the values&lt;/p&gt;

&lt;p&gt;These 3 fields can be objects or an array of objects. One can use an array of objects when he has multi-series data otherwise, an object is enough to get the work done.&lt;/p&gt;

&lt;p&gt;First, we will start with the &lt;strong&gt;series&lt;/strong&gt; field&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import ReactEChart from "echarts-for-react
export default function BarChart() {
    const eChartsOption  {
        series:{
            data: [1oo, 200, 3OO, 400],
            type: "bar"
        }
    };

    return (
         &amp;lt;div&amp;gt;
           &amp;lt;ReactEChart option={eChartsOption} /&amp;gt;
         &amp;lt;/div&amp;gt;
    );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see above, we have included the data and type fields. the data field contains the values that will be used to draw the chart and the type field contains a string that specifies the type of chart to be drawn. the type field can contain the bar, line, pie, scatter, funnel, etc. Check out more types here &lt;a href="https://echarts.apache.org/en/option.html#series" rel="noopener noreferrer"&gt;https://echarts.apache.org/en/option.html#series&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;After adding the above code you will get an error in the console, but don't worry we will soon get rid of it😉&lt;/p&gt;

&lt;p&gt;You can see in the console that &lt;strong&gt;xAxis/yAxis&lt;/strong&gt; but didn't find it. So we just need to add the fields with an empty object assign to them.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import ReactEChart from "echarts-for-react";

export default function BarChart() {
    const eChartsOption = {
        xAxis: {},
        yAxis: {},
        series: {
            data: [101, 200, 300, 400],
            type: "bar",
        },
    };
    return (
        &amp;lt;div&amp;gt;
            &amp;lt;ReactEChart option={eChartsOption} /&amp;gt;
        &amp;lt;/div&amp;gt;
    );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Voila, We got our first chart using Echarts&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4hkgmjc2ilds7pggo7k3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4hkgmjc2ilds7pggo7k3.png" alt="Bar Chart using Echart" width="800" height="371"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But did you notice something strange🤔. The first bar has more space to the left and the last bar is out of the container, we will solve this right now&lt;/p&gt;

&lt;p&gt;As we know our Y-axis contains numerical data i.e values and our X-axis contains categorical data, so we will tell echarts the same, by specifying the type field in &lt;strong&gt;xAxis&lt;/strong&gt; and &lt;strong&gt;yAxis&lt;/strong&gt; field of our &lt;strong&gt;eChartsOption&lt;/strong&gt; object&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import ReactEChart from "echarts-for-react";

export default function BarChart() {
    const eChartsOption = {
        xAxis: {
            type: "category",
        },
        yAxis: {
            type: "value",
        },
        series: {
            data: [101, 200, 300, 400],
            type: "bar",
        },
    };
    return (
        &amp;lt;div
            style={{
                width: "100%",
                height: "100%",
            }}
        &amp;gt;
            &amp;lt;ReactEChart
                style={{
                    width: "100%",
                    height: "100%",
                }}
                option={eChartsOption}
            /&amp;gt;
        &amp;lt;/div&amp;gt;
    );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now our BarChart looks perfect, but it is not at all interactive. We will first enable the tooltip by just specifying the empty &lt;strong&gt;tooltip&lt;/strong&gt; object. We can also add names to our xAxis by specifying the &lt;strong&gt;data&lt;/strong&gt; field in the &lt;strong&gt;xAxis&lt;/strong&gt; object.&lt;/p&gt;

&lt;h2&gt;
  
  
  Multi-Series Chart
&lt;/h2&gt;

&lt;p&gt;We can create a multi-series chart using an Array of objects instead of just an array in &lt;strong&gt;series&lt;/strong&gt; fields&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;series: [
    {
        data: [101, 200, 300, 400, 500, 650],
        type: "bar",
    },
    {
        data: [93, 30, 100, 230, 104, 60],
        type: "line",
    },
];
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frmwt3gj2ruj6gqotdi8n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frmwt3gj2ruj6gqotdi8n.png" alt="Multi-Series Chart (Bar and Line Chart)" width="718" height="359"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Stacked Bar Chart
&lt;/h2&gt;

&lt;p&gt;We have just created a Multi-Series chart that can be easily converted into a Stacked Chart. All we have to do is just add a stack field in every object of the series object&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;series: [
    {
        data: [101, 200, 300, 400, 500, 650],
        type: "bar",
        stack: "total",
    },
    {
        data: [93, 30, 100, 230, 104, 60],
        type: "line",
        stack: "total",
    },
];
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwr9b79kwut3otrwond8k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwr9b79kwut3otrwond8k.png" alt="Stack Bar Chart" width="678" height="318"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;You can find a few other options in the Sandbox attached below, feel free to play with it&lt;/p&gt;

&lt;p&gt;&lt;iframe src="https://codesandbox.io/embed/ecstatic-andras-c48j5y"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;If you like this article, do follow me for more such articles. I would like to hear suggestions too :)&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>webdev</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Why we need Data Structures and Algorithms 🤔</title>
      <dc:creator>Omkar Bhoir</dc:creator>
      <pubDate>Wed, 04 Aug 2021 05:32:31 +0000</pubDate>
      <link>https://dev.to/omkar_bhoir/why-we-need-data-structures-and-algorithms-58c7</link>
      <guid>https://dev.to/omkar_bhoir/why-we-need-data-structures-and-algorithms-58c7</guid>
      <description>&lt;p&gt;&lt;em&gt;If you are a student you might have heard many a times from your teachers or your seniors that Data Structures and Algorithms are very important topic and if you want a good job you should definitely learn it, right?.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In this post we will learn what is this and also why we need to learn it😉&lt;/p&gt;

&lt;h3&gt;
  
  
  What is Data Structure?
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;In simple words, Data Structure is way to organize data in an &lt;strong&gt;efficient&lt;/strong&gt; manner.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;Suppose you have a data of your class (such as id, name, email, etc.) and your teacher told you to store that data in a way so that teacher can easily access and modify that data. What will you do? How will you store that data?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Easiest and common way to do this can be to store that data in an Excel file and share that file with your teacher. Nice&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Yeah, now you have understood that why we need this Data Structures i.e &lt;em&gt;to store the data in a way that is easier to access and modify&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Now what is this algorithm?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;We can define it as a collection of steps to achieve something.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;Imagine you have to do addition of two numbers. How will start? Will you directly add numbers? or Will you check if we have given two numbers?.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This is how I will do it&lt;br&gt;
Step 1: Check if I have two numbers, if not request two numbers&lt;br&gt;
Step 2: Now I have two numbers, so I will add that two numbers and display result on the screen&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Now you might be thinking, why will I waste my energy in writing this steps if I can do it directly. Yes, of course you can do such small operations directly. But when we have to do complex and large operations, it is recommended that we must first decide how our goal can be achieved.&lt;/p&gt;

&lt;p&gt;Enjoy!. Now know what is Data Structures and why we need it and you also know about algorithms.&lt;/p&gt;

&lt;p&gt;Thankyou for reading my post. If you find it informative, please do follow me, like and share with your friends.&lt;/p&gt;

&lt;p&gt;Follow me on Twitter : &lt;a href="https://twitter.com/Omkar_127_0_0_1"&gt;Omkar Bhoir&lt;/a&gt;&lt;/p&gt;

</description>
      <category>algorithms</category>
      <category>dsa</category>
      <category>datastructures</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
