<?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>Drill Down Chart &#8211; Sibeesh Passion</title>
	<atom:link href="https://sibeeshpassion.com/tag/drill-down-chart/feed/" rel="self" type="application/rss+xml" />
	<link>https://sibeeshpassion.com</link>
	<description>My passion towards life</description>
	<lastBuildDate>Tue, 10 Jul 2018 11:50:43 +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>Drill Down Chart &#8211; Sibeesh Passion</title>
	<link>https://sibeeshpassion.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Custom Events In Highcharts</title>
		<link>https://sibeeshpassion.com/custom-events-in-highcharts/</link>
					<comments>https://sibeeshpassion.com/custom-events-in-highcharts/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Tue, 06 Oct 2015 13:38:03 +0000</pubDate>
				<category><![CDATA[HighChart]]></category>
		<category><![CDATA[Products]]></category>
		<category><![CDATA[Custom Events In HighChart]]></category>
		<category><![CDATA[Double Click Event In HighChart Points]]></category>
		<category><![CDATA[Drill Down Chart]]></category>
		<category><![CDATA[HighChart Events]]></category>
		<category><![CDATA[Show Alert When Double Click]]></category>
		<guid isPermaLink="false">http://sibeecst_passion.com/?p=10762</guid>

					<description><![CDATA[In this post we will discuss how we can handle custom events in HighChart . HighChart has already given enough events but sometimes we may need to handle some additional events. For example if we need to fire an alert if user double clicks on the points. Here I am using HighChart Drill Down Chart, So As you all know drill down chart is a chart which populate another chart according to the user action, ie if user click on a particular series, a chart with the related data of the clicked series will get loaded. Now we will go [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>In this post we will discuss how we can handle custom events in <a href="http://sibeeshpassion.com/category/highchart/" target="_blank">HighChart </a>. HighChart has already given enough events but sometimes we may need to handle some additional events. For example if we need to fire an alert if user double clicks on the points. Here I am using HighChart Drill Down Chart, So As you all know drill down chart is a chart which populate another chart according to the user action, ie if user click on a particular series, a chart with the related data of the clicked series will get loaded. Now we will go and see it in action. I hope you will like this. </p>
<p><strong>Background</strong></p>
<p>I am working in a BI dashboard application, thus recently I got a requirement of giving an alert if user clicks on the chart point. Here I will explain the same with an example of high chart drill down type. </p>
<p>Please see the demo here: <a href="http://sibeeshpassion.com/demo/Fire-Double-Click-Event-InHighChart.html" target="_blank">Custom Events in Drill Down Chart</a></p>
<p><strong>Using the code</strong></p>
<p>First of all we will create a page as follows.</p>
<p>[html]<br />
&lt;!DOCTYPE html&gt;<br />
&lt;html&gt;<br />
&lt;head&gt;<br />
    &lt;title&gt;Fire Double Click Events In Highcharts&lt;/title&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
    Fire Double Click Events In Highcharts &#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;/body&gt;<br />
&lt;/html&gt;</p>
<p>[/html]</p>
<p>Next we will add the needed references. </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 />
    &lt;script src=&quot;http://blacklabel.github.io/custom_events/customEvents.js&quot;&gt;&lt;/script&gt;<br />
[/js]</p>
<p>Here you can see we have added a file <em>customEvents.js</em>, please do not forget to add this file. This is much important.</p>
<p>The next step is to load the chart, We can create a chart as follows. </p>
<p>[js]<br />
&lt;script&gt;<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 />
                    }<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 />
                },<br />
                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);</p>
<p>        });<br />
    &lt;/script&gt;<br />
[/js]</p>
<p>Now if you run your page you can see a drill down chart as follows. </p>
<div id="attachment_10764" style="width: 644px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/10/Fire_Double_Click_Events_In_Highcharts.png"><img fetchpriority="high" decoding="async" aria-describedby="caption-attachment-10764" src="http://sibeeshpassion.com/wp-content/uploads/2015/10/Fire_Double_Click_Events_In_Highcharts-1024x301.png" alt="Fire Double Click Events In Highcharts " width="634" height="186" class="size-large wp-image-10764" srcset="/wp-content/uploads/2015/10/Fire_Double_Click_Events_In_Highcharts-1024x301.png 1024w, /wp-content/uploads/2015/10/Fire_Double_Click_Events_In_Highcharts-300x88.png 300w, /wp-content/uploads/2015/10/Fire_Double_Click_Events_In_Highcharts-768x225.png 768w, /wp-content/uploads/2015/10/Fire_Double_Click_Events_In_Highcharts-400x117.png 400w, /wp-content/uploads/2015/10/Fire_Double_Click_Events_In_Highcharts.png 1356w" sizes="(max-width: 634px) 100vw, 634px" /></a><p id="caption-attachment-10764" class="wp-caption-text">Fire Double Click Events In Highcharts</p></div>
<p>Now here is the main part, we need to add a plot option to the chart option so that we can track the events. Please add the preceding lines of code.</p>
<p>[js]<br />
plotOptions: {<br />
                    series: {<br />
                        point: {<br />
                            events: {<br />
                                dblclick: function () {<br />
                                    setTimeout(function () {<br />
                                        alert(&#8216;Double Click Is Not Permitted&#8217;);<br />
                                    }, 1000);<br />
                                    return false;<br />
                                }<br />
                            }<br />
                        }<br />
                    }<br />
                }<br />
[/js]</p>
<p>We have created a custom double click event <em>dblclick</em> successfully. In this way you can create custom events in highchart wherever you want, like create click and double click event in axis and label and data labels so on&#8230;</p>
<p>That&#8217;s all, we did it. Now please find the complete code.</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;Fire Double Click Events In Highcharts&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 src=&quot;http://blacklabel.github.io/custom_events/customEvents.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script&gt;<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 />
                    }<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 />
                        point: {<br />
                            events: {<br />
                                dblclick: function () {<br />
                                    setTimeout(function () {<br />
                                        alert(&#8216;Double Click Is Not Permitted&#8217;);<br />
                                    }, 1000);<br />
                                    return false;<br />
                                }<br />
                            }<br />
                        }<br />
                    }<br />
                },<br />
                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);</p>
<p>        });<br />
    &lt;/script&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
    Fire Double Click Events In Highcharts &#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;/body&gt;<br />
&lt;/html&gt;</p>
<p>[/html]</p>
<p>Now if you run and double click on any series, you will get an output as follows.</p>
<div id="attachment_10769" style="width: 644px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/10/Fire_Double_Click_Events_In_Highcharts_1.png"><img decoding="async" aria-describedby="caption-attachment-10769" src="http://sibeeshpassion.com/wp-content/uploads/2015/10/Fire_Double_Click_Events_In_Highcharts_1-1024x294.png" alt="Fire Double Click Events In Highcharts" width="634" height="182" class="size-large wp-image-10769" srcset="/wp-content/uploads/2015/10/Fire_Double_Click_Events_In_Highcharts_1-1024x294.png 1024w, /wp-content/uploads/2015/10/Fire_Double_Click_Events_In_Highcharts_1-300x86.png 300w, /wp-content/uploads/2015/10/Fire_Double_Click_Events_In_Highcharts_1-768x221.png 768w, /wp-content/uploads/2015/10/Fire_Double_Click_Events_In_Highcharts_1-400x115.png 400w, /wp-content/uploads/2015/10/Fire_Double_Click_Events_In_Highcharts_1.png 1357w" sizes="(max-width: 634px) 100vw, 634px" /></a><p id="caption-attachment-10769" class="wp-caption-text">Fire Double Click Events In Highcharts</p></div>
<p>Please see the JSFiddle link here: <a href="http://jsfiddle.net/sibeeshvenu/h7x37dbr/" target="_blank">Fire Double Click Events In Highcharts </a></p>
<p><strong>Conclusion</strong></p>
<p>Did I miss anything that you may think which is needed? Have you ever wanted this requirement while you play with highchart? Could you find this post as useful? I hope you liked this article. Please share me your valuable suggestions and feedback.</p>
<p><strong>Your turn. What do you think?</strong></p>
<p>A blog isn’t a blog without comments, but do try to stay on topic. If you have a question unrelated to this post, you’re better off posting it on C# Corner, Code Project, Stack Overflow, Asp.Net Forum instead of commenting here. Tweet or email me a link to your question there and I’ll definitely try to help if I am able to.</p>
<p>Kindest Regards<br />
Sibeesh Venu</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sibeeshpassion.com/custom-events-in-highcharts/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Generate JSON According To Drill Down Drill Up Events</title>
		<link>https://sibeeshpassion.com/generate-json-according-to-drill-down-drill-up-events/</link>
					<comments>https://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 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://sibeeshpassion.com/generate-json-according-to-drill-down-drill-up-events/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
	</channel>
</rss>
