<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>highchart source &#8211; Sibeesh Passion</title>
	<atom:link href="https://www.sibeeshpassion.com/tag/highchart-source/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.sibeeshpassion.com</link>
	<description>My passion towards life</description>
	<lastBuildDate>Sun, 02 Aug 2015 14:53:21 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>/wp-content/uploads/2017/04/Sibeesh_Passion_Logo_Small.png</url>
	<title>highchart source &#8211; Sibeesh Passion</title>
	<link>https://www.sibeeshpassion.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Generate JSON According To Drill Down Drill Up Events</title>
		<link>https://www.sibeeshpassion.com/generate-json-according-to-drill-down-drill-up-events/</link>
					<comments>https://www.sibeeshpassion.com/generate-json-according-to-drill-down-drill-up-events/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Sun, 02 Aug 2015 14:53:21 +0000</pubDate>
				<category><![CDATA[Drill Down Chart]]></category>
		<category><![CDATA[HighChart]]></category>
		<category><![CDATA[Drill Down Events]]></category>
		<category><![CDATA[Drill Up Events]]></category>
		<category><![CDATA[Generate JSON According To Drill Down Drill Up Events]]></category>
		<category><![CDATA[HighChart Events]]></category>
		<category><![CDATA[highchart source]]></category>
		<guid isPermaLink="false">http://sibeecst_passion.com/?p=8311</guid>

					<description><![CDATA[In this post, we will see how we can we generate or create JSON dynamically according to users drill up and drill down event actions. We will create JSON when user clicks on a drill down chart&#8217;s series. We will also learn how we will create a Drill Down Chart. With the help of created JSON we can get the information of which are all the series have been clicked by user or which are all the drill series have been seen by the user. We can do some more things with this JSON. Background For the past few weeks, [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>In this post, we will see how we can we generate or create JSON dynamically according to users drill up and drill down event actions. We will create JSON when user clicks on a drill down chart&#8217;s series. We will also learn how we will create a Drill Down Chart. With the help of created JSON we can get the information of which are all the series have been clicked by user or which are all the drill series have been seen by the user. We can do some more things with this JSON. </p>
<p><strong>Background</strong></p>
<p>For the past few weeks, I have been working with the High Chart. And I have got a chance to work with Drill Down chart in High Chart. After implement a drill down chart in my application successfully , I have got an another requirement of creating JSON dynamically according to the user&#8217;s drill down and drill up event action. </p>
<p><strong>Practical Usage</strong></p>
<p>Hereby I am going to share the practical usage of the dynamically crated JSON. We have used this approach in our application. The task was simple but tough though. We have implemented a zooming functionality for each chart we have created. So we placed a zoom button above the chart. When user clicks the zoom button, a dialogue box will be opened with the drill down chart with maximum width and height. The problem we faced is, when user drill the chart to some level and click the zoom button, we were unable to maintain the same drill level in the the chart which is loaded in the dialogue box. Since this functionality was not available in the HighChart itself, We thought to do this our own. For this, we needed the drill level information in which user clicked. So we maintained the information in the format of JSON. And we take the values from this JSON while the new dialogue opens,and apply this to the chart.</p>
<p><strong>Demo</strong></p>
<p>You can see the demo here: <a href="http://sibeeshpassion.com/demo/Generate-JSON-According-To-Drill-Down-Drill-Up-Events/" target="_blank">Generate JSON According To Drill Down Drill Up Events &#8211; Sibeesh Passion</a> </p>
<p><strong>Using the code</strong></p>
<p>The first thing we need to do is to load the required files. </p>
<p>[js]<br />
 &lt;script src=&quot;http://sibeeshpassion.com/content/scripts/jquery-2.0.2.min.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script src=&quot;http://sibeeshpassion.com/content/scripts/highcharts.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script src=&quot;http://sibeeshpassion.com/content/scripts/drilldown.js&quot;&gt;&lt;/script&gt;<br />
[/js]</p>
<p>Now we need the data for the chart right?</p>
<p>[js]<br />
data: [{<br />
                        name: &#8216;Fruits&#8217;,<br />
                        y: 10,<br />
                        drilldown: &#8216;fruits&#8217;<br />
                    }, {<br />
                        name: &#8216;Cars&#8217;,<br />
                        y: 12,<br />
                        drilldown: &#8216;cars&#8217;<br />
                    }, {<br />
                        name: &#8216;Countries&#8217;,<br />
                        y: 8<br />
                    }]<br />
[/js]</p>
<p>Since we are creating a drill down chart, we need to set the drill down data also for the chart.</p>
<p>[js]<br />
drilldown: {<br />
                    series: [{<br />
                        id: &#8216;fruits&#8217;,<br />
                        name: &#8216;Fruits&#8217;,<br />
                        data: [<br />
                            [&#8216;Apples&#8217;, 4],<br />
                            [&#8216;Pears&#8217;, 6],<br />
                            [&#8216;Oranges&#8217;, 2],<br />
                            [&#8216;Grapes&#8217;, 8]<br />
                        ]<br />
                    }, {<br />
                        id: &#8216;cars&#8217;,<br />
                        name: &#8216;Cars&#8217;,<br />
                        data: [{<br />
                            name: &#8216;Toyota&#8217;,<br />
                            y: 4,<br />
                            drilldown: &#8216;toyota&#8217;<br />
                        },<br />
                        [&#8216;Volkswagen&#8217;, 3],<br />
                        [&#8216;Opel&#8217;, 5]<br />
                        ]<br />
                    }, {<br />
                        id: &#8216;toyota&#8217;,<br />
                        name: &#8216;Toyota&#8217;,<br />
                        data: [<br />
                            [&#8216;RAV4&#8217;, 3],<br />
                            [&#8216;Corolla&#8217;, 1],<br />
                            [&#8216;Carina&#8217;, 4],<br />
                            [&#8216;Land Cruiser&#8217;, 5]<br />
                        ]<br />
                    }]<br />
                }<br />
[/js]</p>
<p>So we have set the data, now we need to set the complete options for our chart, we will set this in a variable.</p>
<p>[js]<br />
 var options = {<br />
                chart: {<br />
                    height: 300,<br />
                    events: {<br />
                        drilldown: function (e) {<br />
                        },<br />
                        drillup: function (e) {<br />
                        }<br />
                    }<br />
                },</p>
<p>                title: {<br />
                    text: &#8216;Highcharts Drilldown Plugin&#8217;<br />
                },</p>
<p>                xAxis: {<br />
                    categories: true<br />
                },</p>
<p>                drilldown: {<br />
                    series: [{<br />
                        id: &#8216;fruits&#8217;,<br />
                        name: &#8216;Fruits&#8217;,<br />
                        data: [<br />
                            [&#8216;Apples&#8217;, 4],<br />
                            [&#8216;Pears&#8217;, 6],<br />
                            [&#8216;Oranges&#8217;, 2],<br />
                            [&#8216;Grapes&#8217;, 8]<br />
                        ]<br />
                    }, {<br />
                        id: &#8216;cars&#8217;,<br />
                        name: &#8216;Cars&#8217;,<br />
                        data: [{<br />
                            name: &#8216;Toyota&#8217;,<br />
                            y: 4,<br />
                            drilldown: &#8216;toyota&#8217;<br />
                        },<br />
                        [&#8216;Volkswagen&#8217;, 3],<br />
                        [&#8216;Opel&#8217;, 5]<br />
                        ]<br />
                    }, {<br />
                        id: &#8216;toyota&#8217;,<br />
                        name: &#8216;Toyota&#8217;,<br />
                        data: [<br />
                            [&#8216;RAV4&#8217;, 3],<br />
                            [&#8216;Corolla&#8217;, 1],<br />
                            [&#8216;Carina&#8217;, 4],<br />
                            [&#8216;Land Cruiser&#8217;, 5]<br />
                        ]<br />
                    }]<br />
                },</p>
<p>                legend: {<br />
                    enabled: false<br />
                },</p>
<p>                plotOptions: {<br />
                    series: {<br />
                        dataLabels: {<br />
                            enabled: true<br />
                        },<br />
                        shadow: false<br />
                    },<br />
                    pie: {<br />
                        size: &#8216;80%&#8217;<br />
                    }<br />
                },</p>
<p>                series: [{<br />
                    name: &#8216;Overview&#8217;,<br />
                    colorByPoint: true,<br />
                    data: [{<br />
                        name: &#8216;Fruits&#8217;,<br />
                        y: 10,<br />
                        drilldown: &#8216;fruits&#8217;<br />
                    }, {<br />
                        name: &#8216;Cars&#8217;,<br />
                        y: 12,<br />
                        drilldown: &#8216;cars&#8217;<br />
                    }, {<br />
                        name: &#8216;Countries&#8217;,<br />
                        y: 8<br />
                    }]<br />
                }]<br />
            };<br />
[/js]</p>
<p>Everything is set now, what else we need then? Yes we need to assign this option to our chart!.</p>
<p>[js]<br />
// Drill Down Chart Implementation<br />
            options.chart.renderTo = &#8216;container&#8217;;<br />
            options.chart.type = &#8216;column&#8217;;<br />
            var chart1 = new Highcharts.Chart(options);<br />
[/js]</p>
<p>As you can see in the above code, we are rendering the chart to a div called <em>container</em>. So we need to create a dv right?</p>
<p>[html]<br />
&lt;body&gt;<br />
    Generate JSON According To Drill Down Drill Up Events &#8211; Sibeesh Passion (&lt;a href=&quot;http://sibeeshpassion.com&quot;&gt;Sibeesh Passion &lt;/a&gt;)<br />
    &lt;br/&gt;<br />
	&lt;br/&gt;<br />
	&lt;br/&gt;<br />
    &lt;div id=&quot;container&quot; style=&quot;height: 300px&quot;&gt;&lt;/div&gt;<br />
	&lt;div id=&quot;jsonContent&quot;&gt;&lt;/div&gt;<br />
&lt;/body&gt;<br />
[/html]</p>
<p>Now we are ready to run our chart. Shall we run it? If you run, you will get the output as follows.</p>
<p><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/Generate-JSON_According-To-Drill-Down-Drill-Up-Events1.png"><img fetchpriority="high" decoding="async" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/Generate-JSON_According-To-Drill-Down-Drill-Up-Events1-1024x356.png" alt="Generate-JSON_According-To-Drill-Down-Drill-Up-Events1" width="634" height="220" class="alignnone size-large wp-image-8371" srcset="/wp-content/uploads/2015/08/Generate-JSON_According-To-Drill-Down-Drill-Up-Events1-1024x356.png 1024w, /wp-content/uploads/2015/08/Generate-JSON_According-To-Drill-Down-Drill-Up-Events1-300x104.png 300w, /wp-content/uploads/2015/08/Generate-JSON_According-To-Drill-Down-Drill-Up-Events1-768x267.png 768w, /wp-content/uploads/2015/08/Generate-JSON_According-To-Drill-Down-Drill-Up-Events1-400x139.png 400w, /wp-content/uploads/2015/08/Generate-JSON_According-To-Drill-Down-Drill-Up-Events1.png 634w" sizes="(max-width: 634px) 100vw, 634px" /></a></p>
<p>Now if you drill down to <em>Cars</em> you will get the below output.</p>
<p><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/Generate-JSON_According-To-Drill-Down-Drill-Up-Events2.png"><img decoding="async" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/Generate-JSON_According-To-Drill-Down-Drill-Up-Events2-1024x264.png" alt="Generate-JSON_According-To-Drill-Down-Drill-Up-Events2" width="634" height="163" class="alignnone size-large wp-image-8381" srcset="/wp-content/uploads/2015/08/Generate-JSON_According-To-Drill-Down-Drill-Up-Events2-1024x264.png 1024w, /wp-content/uploads/2015/08/Generate-JSON_According-To-Drill-Down-Drill-Up-Events2-300x77.png 300w, /wp-content/uploads/2015/08/Generate-JSON_According-To-Drill-Down-Drill-Up-Events2-768x198.png 768w, /wp-content/uploads/2015/08/Generate-JSON_According-To-Drill-Down-Drill-Up-Events2-400x103.png 400w, /wp-content/uploads/2015/08/Generate-JSON_According-To-Drill-Down-Drill-Up-Events2.png 634w" sizes="(max-width: 634px) 100vw, 634px" /></a></p>
<p>It is time to create the JSON now. We will save the JSON value to sessionStorage. If you are new to sessionStorage and localStorage you can read it here: <a href="http://sibeeshpassion.com/tag/local-storage/" target="_blank">Storage Mechanism in HTML5</a></p>
<p>Once we assign the value to the storage, you can see that in browser console. We will also set this value to a div called <em>jsonContent</em>. </p>
<p>We will create a function for creating this JSON first.</p>
<p>[js]<br />
 function generateDrillDownJSON(e, isDrillUp) {<br />
            try {<br />
                if (isDrillUp) {<br />
                    if (myJSON != null &amp;&amp; myJSON.length &gt; 0) {<br />
                        removeArrayElementByIndex(myJSON, myJSON.length &#8211; 1);<br />
                    }<br />
                    sessionStorage.setItem(&#8216;DrillDownJSON&#8217;, JSON.stringify(myJSON));<br />
					$(&quot;#jsonContent&quot;).html(&#8216;JSON content is: &#8216;).append(JSON.stringify(myJSON));<br />
                } else {<br />
                    myJSON.push({<br />
                        name: e.point.name,<br />
                        level: myJSON.length + 1,<br />
                    });<br />
                    sessionStorage.setItem(&#8216;DrillDownJSON&#8217;, JSON.stringify(myJSON));<br />
					$(&quot;#jsonContent&quot;).html(&#8216;JSON content is: &#8216;).append(JSON.stringify(myJSON));<br />
                }</p>
<p>            } catch (e) {<br />
                console.log(&#8216;generateHierarchyJSON :&#8217; + e.message);<br />
            }<br />
        }<br />
[/js]</p>
<p>As you can see we are handling the drill events in this function. If it is drill up event, we are removing the values from the JSON created. To remove, we are creating an another function.</p>
<p>[js]<br />
 function removeArrayElementByIndex(myArray, index) {<br />
            myArray.splice(index, 1);<br />
        }<br />
[/js]</p>
<p>We will call our function <em>generateDrillDownJSON</em> in both drill down and drill up event. </p>
<p>[js]<br />
events: {<br />
                        drilldown: function (e) {<br />
                            generateDrillDownJSON(e, false);<br />
                        },<br />
                        drillup: function (e) {<br />
                            generateDrillDownJSON(e, true);<br />
                        }<br />
                    }<br />
[/js]</p>
<p>It is time to see our implementation and check whether it is working fine or not. So run your application now and click on the <em>Cars</em> series. You can see the JSON created in our div.</p>
<p><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/Generate-JSON_According-To-Drill-Down-Drill-Up-Events3.png"><img decoding="async" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/Generate-JSON_According-To-Drill-Down-Drill-Up-Events3-1024x302.png" alt="Generate-JSON_According-To-Drill-Down-Drill-Up-Events3" width="634" height="187" class="alignnone size-large wp-image-8391" srcset="/wp-content/uploads/2015/08/Generate-JSON_According-To-Drill-Down-Drill-Up-Events3-1024x302.png 1024w, /wp-content/uploads/2015/08/Generate-JSON_According-To-Drill-Down-Drill-Up-Events3-300x88.png 300w, /wp-content/uploads/2015/08/Generate-JSON_According-To-Drill-Down-Drill-Up-Events3-768x226.png 768w, /wp-content/uploads/2015/08/Generate-JSON_According-To-Drill-Down-Drill-Up-Events3-400x118.png 400w, /wp-content/uploads/2015/08/Generate-JSON_According-To-Drill-Down-Drill-Up-Events3.png 634w" sizes="(max-width: 634px) 100vw, 634px" /></a></p>
<p>If you need to see the JSON value in the session storage, please click F12 and check in session storage.</p>
<p><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/Generate-JSON_According-To-Drill-Down-Drill-Up-Events4.png"><img decoding="async" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/Generate-JSON_According-To-Drill-Down-Drill-Up-Events4-300x58.png" alt="Generate-JSON_According-To-Drill-Down-Drill-Up-Events4" width="300" height="58" class="alignnone size-medium wp-image-8401" srcset="/wp-content/uploads/2015/08/Generate-JSON_According-To-Drill-Down-Drill-Up-Events4-300x58.png 300w, /wp-content/uploads/2015/08/Generate-JSON_According-To-Drill-Down-Drill-Up-Events4-768x148.png 768w, /wp-content/uploads/2015/08/Generate-JSON_According-To-Drill-Down-Drill-Up-Events4-400x77.png 400w, /wp-content/uploads/2015/08/Generate-JSON_According-To-Drill-Down-Drill-Up-Events4.png 634w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/Generate-JSON_According-To-Drill-Down-Drill-Up-Events5.png"><img decoding="async" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/Generate-JSON_According-To-Drill-Down-Drill-Up-Events5-1024x403.png" alt="Generate-JSON_According-To-Drill-Down-Drill-Up-Events5" width="634" height="250" class="alignnone size-large wp-image-8411" srcset="/wp-content/uploads/2015/08/Generate-JSON_According-To-Drill-Down-Drill-Up-Events5-1024x403.png 1024w, /wp-content/uploads/2015/08/Generate-JSON_According-To-Drill-Down-Drill-Up-Events5-300x118.png 300w, /wp-content/uploads/2015/08/Generate-JSON_According-To-Drill-Down-Drill-Up-Events5-768x302.png 768w, /wp-content/uploads/2015/08/Generate-JSON_According-To-Drill-Down-Drill-Up-Events5-400x157.png 400w, /wp-content/uploads/2015/08/Generate-JSON_According-To-Drill-Down-Drill-Up-Events5.png 634w" sizes="(max-width: 634px) 100vw, 634px" /></a></p>
<p>Now we will try the drill up event and check the JSON value.</p>
<p><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/Generate-JSON_According-To-Drill-Down-Drill-Up-Events6.png"><img decoding="async" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/Generate-JSON_According-To-Drill-Down-Drill-Up-Events6-1024x406.png" alt="Generate-JSON_According-To-Drill-Down-Drill-Up-Events6" width="634" height="251" class="alignnone size-large wp-image-8421" srcset="/wp-content/uploads/2015/08/Generate-JSON_According-To-Drill-Down-Drill-Up-Events6-1024x406.png 1024w, /wp-content/uploads/2015/08/Generate-JSON_According-To-Drill-Down-Drill-Up-Events6-300x119.png 300w, /wp-content/uploads/2015/08/Generate-JSON_According-To-Drill-Down-Drill-Up-Events6-768x305.png 768w, /wp-content/uploads/2015/08/Generate-JSON_According-To-Drill-Down-Drill-Up-Events6-400x159.png 400w, /wp-content/uploads/2015/08/Generate-JSON_According-To-Drill-Down-Drill-Up-Events6.png 634w" sizes="(max-width: 634px) 100vw, 634px" /></a></p>
<p><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/Generate-JSON_According-To-Drill-Down-Drill-Up-Events7.png"><img decoding="async" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/Generate-JSON_According-To-Drill-Down-Drill-Up-Events7-1024x404.png" alt="Generate-JSON_According-To-Drill-Down-Drill-Up-Events7" width="634" height="250" class="alignnone size-large wp-image-8431" srcset="/wp-content/uploads/2015/08/Generate-JSON_According-To-Drill-Down-Drill-Up-Events7-1024x404.png 1024w, /wp-content/uploads/2015/08/Generate-JSON_According-To-Drill-Down-Drill-Up-Events7-300x118.png 300w, /wp-content/uploads/2015/08/Generate-JSON_According-To-Drill-Down-Drill-Up-Events7-768x303.png 768w, /wp-content/uploads/2015/08/Generate-JSON_According-To-Drill-Down-Drill-Up-Events7-400x158.png 400w, /wp-content/uploads/2015/08/Generate-JSON_According-To-Drill-Down-Drill-Up-Events7.png 634w" sizes="(max-width: 634px) 100vw, 634px" /></a></p>
<p>You can see that while drill up, we are deleting those values from JSON. </p>
<p><strong>Complete Code</strong></p>
<p>[html]<br />
&lt;!DOCTYPE html&gt;<br />
&lt;html&gt;<br />
&lt;head&gt;<br />
    &lt;title&gt;Generate JSON According To Drill Down Drill Up Events Demo-Sibeesh Passion&lt;/title&gt;<br />
    &lt;script src=&quot;http://sibeeshpassion.com/content/scripts/jquery-2.0.2.min.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script src=&quot;http://sibeeshpassion.com/content/scripts/highcharts.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script src=&quot;http://sibeeshpassion.com/content/scripts/drilldown.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script&gt;<br />
        var myJSON = [];<br />
        $(document).ready(function () {<br />
            // Internationalization<br />
            Highcharts.setOptions({<br />
                lang: {<br />
                    drillUpText: &#8216;◁ Back to {series.name}&#8217;<br />
                }<br />
            });</p>
<p>            var options = {<br />
                chart: {<br />
                    height: 300,<br />
                    events: {<br />
                        drilldown: function (e) {<br />
                            generateDrillDownJSON(e, false);<br />
                        },<br />
                        drillup: function (e) {<br />
                            generateDrillDownJSON(e, true);<br />
                        }<br />
                    }<br />
                },</p>
<p>                title: {<br />
                    text: &#8216;Highcharts Drilldown Plugin&#8217;<br />
                },</p>
<p>                xAxis: {<br />
                    categories: true<br />
                },</p>
<p>                drilldown: {<br />
                    series: [{<br />
                        id: &#8216;fruits&#8217;,<br />
                        name: &#8216;Fruits&#8217;,<br />
                        data: [<br />
                            [&#8216;Apples&#8217;, 4],<br />
                            [&#8216;Pears&#8217;, 6],<br />
                            [&#8216;Oranges&#8217;, 2],<br />
                            [&#8216;Grapes&#8217;, 8]<br />
                        ]<br />
                    }, {<br />
                        id: &#8216;cars&#8217;,<br />
                        name: &#8216;Cars&#8217;,<br />
                        data: [{<br />
                            name: &#8216;Toyota&#8217;,<br />
                            y: 4,<br />
                            drilldown: &#8216;toyota&#8217;<br />
                        },<br />
                        [&#8216;Volkswagen&#8217;, 3],<br />
                        [&#8216;Opel&#8217;, 5]<br />
                        ]<br />
                    }, {<br />
                        id: &#8216;toyota&#8217;,<br />
                        name: &#8216;Toyota&#8217;,<br />
                        data: [<br />
                            [&#8216;RAV4&#8217;, 3],<br />
                            [&#8216;Corolla&#8217;, 1],<br />
                            [&#8216;Carina&#8217;, 4],<br />
                            [&#8216;Land Cruiser&#8217;, 5]<br />
                        ]<br />
                    }]<br />
                },</p>
<p>                legend: {<br />
                    enabled: false<br />
                },</p>
<p>                plotOptions: {<br />
                    series: {<br />
                        dataLabels: {<br />
                            enabled: true<br />
                        },<br />
                        shadow: false<br />
                    },<br />
                    pie: {<br />
                        size: &#8216;80%&#8217;<br />
                    }<br />
                },</p>
<p>                series: [{<br />
                    name: &#8216;Overview&#8217;,<br />
                    colorByPoint: true,<br />
                    data: [{<br />
                        name: &#8216;Fruits&#8217;,<br />
                        y: 10,<br />
                        drilldown: &#8216;fruits&#8217;<br />
                    }, {<br />
                        name: &#8216;Cars&#8217;,<br />
                        y: 12,<br />
                        drilldown: &#8216;cars&#8217;<br />
                    }, {<br />
                        name: &#8216;Countries&#8217;,<br />
                        y: 8<br />
                    }]<br />
                }]<br />
            };</p>
<p>            // Drill Down Chart Implementation<br />
            options.chart.renderTo = &#8216;container&#8217;;<br />
            options.chart.type = &#8216;column&#8217;;<br />
            var chart1 = new Highcharts.Chart(options);<br />
        });<br />
        function generateDrillDownJSON(e, isDrillUp) {<br />
            try {<br />
                if (isDrillUp) {<br />
                    if (myJSON != null &amp;&amp; myJSON.length &gt; 0) {<br />
                        removeArrayElementByIndex(myJSON, myJSON.length &#8211; 1);<br />
                    }<br />
                    sessionStorage.setItem(&#8216;DrillDownJSON&#8217;, JSON.stringify(myJSON));<br />
					$(&quot;#jsonContent&quot;).html(&#8216;JSON content is: &#8216;).append(JSON.stringify(myJSON));<br />
                } else {<br />
                    myJSON.push({<br />
                        name: e.point.name,<br />
                        level: myJSON.length + 1,<br />
                    });<br />
                    sessionStorage.setItem(&#8216;DrillDownJSON&#8217;, JSON.stringify(myJSON));<br />
					$(&quot;#jsonContent&quot;).html(&#8216;JSON content is: &#8216;).append(JSON.stringify(myJSON));<br />
                }</p>
<p>            } catch (e) {<br />
                console.log(&#8216;generateHierarchyJSON :&#8217; + e.message);<br />
            }<br />
        }<br />
        function removeArrayElementByIndex(myArray, index) {<br />
            myArray.splice(index, 1);<br />
        }<br />
    &lt;/script&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
    Generate JSON According To Drill Down Drill Up Events &#8211; Sibeesh Passion (&lt;a href=&quot;http://sibeeshpassion.com&quot;&gt;Sibeesh Passion &lt;/a&gt;)<br />
    &lt;br/&gt;<br />
	&lt;br/&gt;<br />
	&lt;br/&gt;<br />
    &lt;div id=&quot;container&quot; style=&quot;height: 300px&quot;&gt;&lt;/div&gt;<br />
	&lt;div id=&quot;jsonContent&quot;&gt;&lt;/div&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;<br />
[/html]</p>
<p><strong>Conclusion</strong></p>
<p>I hope you liked my article. Please share me your valuable feedback and suggestions. Thanks in advance.</p>
<p>Kindest Regards<br />
Sibeesh Venu<br />
<a href="http://sibeeshpassion.com/" target="_blank">http://sibeeshpassion.com/</a> </p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sibeeshpassion.com/generate-json-according-to-drill-down-drill-up-events/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Working With Charts</title>
		<link>https://www.sibeeshpassion.com/working-with-charts/</link>
					<comments>https://www.sibeeshpassion.com/working-with-charts/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Wed, 29 Apr 2015 20:35:46 +0000</pubDate>
				<category><![CDATA[HighChart]]></category>
		<category><![CDATA[chart]]></category>
		<category><![CDATA[High Chart Demo]]></category>
		<category><![CDATA[highchart source]]></category>
		<category><![CDATA[HTML5 Chart]]></category>
		<category><![CDATA[implement highchart]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Working with high chart]]></category>
		<guid isPermaLink="false">https://sibeeshpassion.com/?p=1861</guid>

					<description><![CDATA[Introduction This tip says how to formulate our data as a High Chart. Please provide your valuable comments. 🙂 Background I am working in a project where 80% of the processes are handled in the client side itself. So I was looking for a client-side chart and High Chart satisfied my requiremetns. It is a good plugin and also easy to use. What is High Chart? High Charts is solely based on native browser technologies and doesn&#8217;t require client-side plugins like Flash or Java. Furthermore you don&#8217;t need to install anything on your server. No PHP or ASP.NET. High Charts [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><strong>Introduction</strong></p>
<p>This tip says how to formulate our data as a High Chart. Please provide your valuable comments. 🙂</p>
<p><strong>Background</strong></p>
<p>I am working in a project where 80% of the processes are handled in the client side itself. So I was looking for a client-side chart and High Chart satisfied my requiremetns. It is a good plugin and also easy to use. What is High Chart? High Charts is solely based on native browser technologies and doesn&#8217;t require client-side plugins like Flash or Java. Furthermore you don&#8217;t need to install anything on your server. No PHP or ASP.NET. High Charts needs only two JavaScript files to run, the highcharts.js core and either the jQuery, MooTools, Prototype or High Charts Standalone framework. The High Charts Standalone framework is designed for those who do not already use jQuery, MooTools or Prototype in their web page and wish to use High Charts with minimal overhead. Read more here:<a href="http://www.highcharts.com/docs" target="_blank"> HIGHCHARTS, HIGHSTOCK AND HIGHMAPS DOCUMENTATION</a>.</p>
<p><strong>What you must know</strong></p>
<ol>
<li>jQuery :<a href="http://jquery.com/">jQuery</a> .</li>
<li>JavaScript :<a href="http://www.w3schools.com/js/">W3Schools.com</a>.</li>
<li>CSS 3 : <a href="http://www.w3schools.com/css/css3_intro.asp">CSS3 Introduction</a> .</li>
<li>HTML :<a href="http://www.w3schools.com/html/">HTML(5) Tutorial</a> .</li>
<li>DOM Manipulations in jQuery :<a href="http://www.tutorialspoint.com/jquery/jquery-dom.htm">jQuery &#8211; DOM Manipulation</a> .</li>
</ol>
<div><strong>Using the code</strong></div>
<p>Before you start, you need to download the necessary files from: <a href="http://www.highcharts.com/download">http://www.highcharts.com/download</a>. Once you download the files, you need to include those in your project. Or you can use the CDN also.</p>
<p>[js]<br />
&lt;script src=“http://code.highcharts.com/highcharts.js”&gt;&lt;/script&gt;<br />
&lt;script src=“http://code.highcharts.com/modules/heatmap.js”&gt;&lt;/script&gt;<br />
&lt;script src=“http://code.highcharts.com/modules/exporting.js”&gt;&lt;/script&gt;<br />
[/js]</p>
<p>Now it is time to add a UI element in which we will generate the chart. Please assign some width to that element, so that our chart can be formulated inside that element.<br />
[html]<br />
&lt;div id=“container” style=“height: 400px; min-width: 310px; max-width: 800px; margin: 0 auto”&gt;&lt;/div&gt;<br />
[/html]</p>
<p>Now what else is pending is only to add the script that does the formulation work as in the following:<br />
[js]<br />
$(function() {<br />
    $(‘#container’).highcharts({<br />
        chart: {<br />
            type: ‘heatmap’,<br />
            marginTop: 40,<br />
            marginBottom: 40<br />
        },<br />
        title: {<br />
            text: ‘Sales per employee per weekday’<br />
        },<br />
        xAxis: {<br />
            categories: [‘Alexander’, ‘Marie’, ‘Maximilian’, ‘Sophia’, ‘Lukas’, ‘Maria’, ‘Leon’, ‘Anna’, ‘Tim’, ‘Laura’]<br />
        },<br />
        yAxis: {<br />
            categories: [‘Monday’, ‘Tuesday’, ‘Wednesday’, ‘Thursday’, ‘Friday’],<br />
            title: null<br />
        },<br />
        colorAxis: {<br />
            min: 0,<br />
            minColor: ‘#FFFFFF’,<br />
            maxColor: Highcharts.getOptions().colors[0]<br />
        },<br />
        legend: {<br />
            align: ‘right’,<br />
            layout: ‘vertical’,<br />
            margin: 0,<br />
            verticalAlign: ‘top’,<br />
            y: 25,<br />
            symbolHeight: 320<br />
        },<br />
        tooltip: {<br />
            formatter: function() {<br />
                return ‘&lt;b&gt;’<br />
                this.series.xAxis.categories[this.point.x]<br />
                ‘&lt;/b&gt; sold &lt;br&gt;&lt;b&gt;’<br />
                this.point.value ‘&lt;/b&gt; items on &lt;br&gt;&lt;b&gt;’<br />
                this.series.yAxis.categories[this.point.y]<br />
                ‘&lt;/b&gt;’;<br />
            }<br />
        },<br />
        series: [{<br />
            name: ‘Sales per employee’,<br />
            borderWidth: 1,<br />
            data: [<br />
                [0, 0, 10],<br />
                [0, 1, 19],<br />
                [0, 2, 8],<br />
                [0, 3, 24],<br />
                [0, 4, 67],<br />
                [1, 0, 92],<br />
                [1, 1, 58],<br />
                [1, 2, 78],<br />
                [1, 3, 117],<br />
                [1, 4, 48],<br />
                [2, 0, 35],<br />
                [2, 1, 15],<br />
                [2, 2, 123],<br />
                [2, 3, 64],<br />
                [2, 4, 52],<br />
                [3, 0, 72],<br />
                [3, 1, 132],<br />
                [3, 2, 114],<br />
                [3, 3, 19],<br />
                [3, 4, 16],<br />
                [4, 0, 38],<br />
                [4, 1, 5],<br />
                [4, 2, 8],<br />
                [4, 3, 117],<br />
                [4, 4, 115],<br />
                [5, 0, 88],<br />
                [5, 1, 32],<br />
                [5, 2, 12],<br />
                [5, 3, 6],<br />
                [5, 4, 120],<br />
                [6, 0, 13],<br />
                [6, 1, 44],<br />
                [6, 2, 88],<br />
                [6, 3, 98],<br />
                [6, 4, 96],<br />
                [7, 0, 31],<br />
                [7, 1, 1],<br />
                [7, 2, 82],<br />
                [7, 3, 32],<br />
                [7, 4, 30],<br />
                [8, 0, 85],<br />
                [8, 1, 97],<br />
                [8, 2, 123],<br />
                [8, 3, 64],<br />
                [8, 4, 84],<br />
                [9, 0, 47],<br />
                [9, 1, 114],<br />
                [9, 2, 31],<br />
                [9, 3, 48],<br />
                [9, 4, 91]<br />
            ],<br />
            dataLabels: {<br />
                enabled: true,<br />
                color: ‘black’,<br />
                style: {<br />
                    textShadow: ‘none’,<br />
                    HcTextStroke: null<br />
                }<br />
            }<br />
        }]<br />
    });<br />
});<br />
[/js]</p>
<p><strong>Explanation</strong></p>
<p>Now it&#8217;s time to go deeper to see what we have done. There are a few properties we have set for our chat so far. The following are what they are:</p>
<div>
<ul>
<li>Chart: This property sets the chart type and chart styles. Here in this I am using heatmap. And you can set your own style to it.</li>
<li>Title: This sets the title for our chart. You can set a meaningful title related to our chart.</li>
<li>XAxis: Here you need to bind the series of elements that all you need to come under in X axis. You can bind that to the inner property categories.</li>
<li>YAxis: Here you need to bind the series of elements that all you need to come under in Y axis. You can bind that to the inner property categories.</li>
<li>ColorAxis: This property sets the colors for the chart. You can set the min color and max color so that we can get the shadow effect.</li>
<li>Legend: This is where we can set the limitation of which quadrant we need to show the data. You can set the y value to get the values as it&#8217;s multiplied one. You can also set its alignment.</li>
<li>Tooltip: Tooltip plays a main role in this chart, when you mouse over to the specific column you can see the small pop up that shows the exact value. You can set your own style for this J</li>
<li>Series: Now it&#8217;s time to apply the data. This is where we need to do that.</li>
</ul>
</div>
<div>You can find more and do the options in this JavaScript fiddle.</p>
<p><a href="http://jsfiddle.net/Sibeeshvenu/tgzvbqxb/">Sibeeshvevenu</a></div>
<p><strong>Output</strong></p>
<p><img decoding="async" src="http://www.c-sharpcorner.com/UploadFile/65794e/working-with-chart/Images/highchart.png" alt="" width="600" height="303" /></p>
<p><strong>Points of Interest</strong></p>
<p>jQuery, CSS, HTML and HighChart.</p>
<p><strong>History</strong></p>
<p>1st Version: 08-May-2015</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sibeeshpassion.com/working-with-charts/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
