<?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>chart &#8211; Sibeesh Passion</title>
	<atom:link href="https://sibeeshpassion.com/tag/chart/feed/" rel="self" type="application/rss+xml" />
	<link>https://sibeeshpassion.com</link>
	<description>My passion towards life</description>
	<lastBuildDate>Wed, 02 Jun 2021 15:16:14 +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>chart &#8211; Sibeesh Passion</title>
	<link>https://sibeeshpassion.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Working With Charts Using Spire.XLS</title>
		<link>https://sibeeshpassion.com/working-with-charts-using-spire-xls/</link>
					<comments>https://sibeeshpassion.com/working-with-charts-using-spire-xls/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Tue, 11 Aug 2015 15:45:19 +0000</pubDate>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Products]]></category>
		<category><![CDATA[Spire.XLS]]></category>
		<category><![CDATA[VB.Net]]></category>
		<category><![CDATA[chart]]></category>
		<category><![CDATA[Charts Using Spire.XLS]]></category>
		<category><![CDATA[Column Charts]]></category>
		<category><![CDATA[Pie Charts]]></category>
		<category><![CDATA[Save Excel Charts as Images]]></category>
		<category><![CDATA[Spire.XLs]]></category>
		<guid isPermaLink="false">http://sibeecst_passion.com/?p=8751</guid>

					<description><![CDATA[Today we are going to see an another series of new product Spire.XLS which helps us to create, manipulate, convert EXCEL file to other formats, create charts dynamically and many more. This product has been introduced by the company E-Iceblue. I hope you have read my article of Spire.Doc and Spire.XLS. If you have not read it, I recommend you to read it here: Using Spire.XLS Background As you all know, charts are the graphical representations of our data. It is much easier to understand our data if it is in a graphical form. Am I right? It is easy [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Today we are going to see an another series of new product <em>Spire.XLS</em> which helps us to create, manipulate, convert EXCEL file to other formats, create charts dynamically and many more. This product has been introduced by the company <a href="http://www.e-iceblue.com/" target="_blank" rel="noopener">E-Iceblue</a>. I hope you have read my article of <em>Spire.Doc</em> and <em>Spire.XLS</em>. If you have not read it, I recommend you to read it here: <a href="http://sibeeshpassion.com/using-spire-xls/" target="_blank" rel="noopener">Using Spire.XLS</a></p>
<p><strong>Background</strong></p>
<p>As you all know, charts are the graphical representations of our data. It is much easier to understand our data if it is in a graphical form. Am I right? It is easy to create a static chart, but what about a dynamic one? It will be bit tough right? But by using Spire.XLS, we can create any kind of charts easily. In this post, we will see those implementations. </p>
<p><strong>Download the files</strong></p>
<p>You can always get the needed files from here: <a href="http://www.e-iceblue.com/Download/download-excel-for-net-now.html" target="_blank" rel="noopener">Download Spire.XLS</a></p>
<p><strong>Install Spire.XLS</strong></p>
<p>I am using evaluation version with one month temporary license. There are free versions also available for spire.xls with some limitation. You can try that. Now click on the exe file after you extract the downloaded file. The installation will get started then.</p>
<p><img decoding="async" src="http://sibeeshpassion.com/content/images/InstallSpireXls.png" alt="Using Spire XLS" /></p>
<p><strong>Using the code</strong></p>
<p>Before starting with coding you need to add the needed namespaces as follows.</p>
<p>[csharp]<br />
using Spire.Xls;<br />
using System.Drawing;<br />
[/csharp]</p>
<p>First of all create a form and then a button, in the button click add the following lines of codes.</p>
<p><strong>C# Code</strong></p>
<p>[csharp]<br />
  private void button1_Click(object sender, EventArgs e)<br />
        {<br />
            try<br />
            {<br />
                //Create a new workbook<br />
                Workbook workbook = new Workbook();<br />
                //Initialize worksheet<br />
                workbook.CreateEmptySheets(1);<br />
                Worksheet sheet = workbook.Worksheets[0];<br />
                //Set sheet name<br />
                sheet.Name = &quot;Chart data&quot;;<br />
                //Set the grid lines invisible<br />
                sheet.GridLinesVisible = false;<br />
                //Create a chart<br />
                Chart chart = sheet.Charts.Add(ExcelChartType.Pie3D);<br />
                //Set region of chart data<br />
                chart.DataRange = sheet.Range[&quot;B2:B5&quot;];<br />
                chart.SeriesDataFromRange = false;<br />
                //Set position of chart<br />
                chart.LeftColumn = 1;<br />
                chart.TopRow = 6;<br />
                chart.RightColumn = 9;<br />
                chart.BottomRow = 25;<br />
                //Chart title<br />
                chart.ChartTitle = &quot;Sales by year&quot;;<br />
                chart.ChartTitleArea.IsBold = true;<br />
                chart.ChartTitleArea.Size = 12;<br />
                //Initialize the chart series<br />
                Spire.Xls.Charts.ChartSerie cs = chart.Series[0];<br />
                //Chart Labels resource<br />
                cs.CategoryLabels = sheet.Range[&quot;A2:A5&quot;];<br />
                //Chart value resource<br />
                cs.Values = sheet.Range[&quot;B2:B5&quot;];<br />
                //Set the value visible in the chart<br />
                cs.DataPoints.DefaultDataPoint.DataLabels.HasValue = true;<br />
                //Year<br />
                sheet.Range[&quot;A1&quot;].Value = &quot;Year&quot;;<br />
                sheet.Range[&quot;A2&quot;].Value = &quot;2002&quot;;<br />
                sheet.Range[&quot;A3&quot;].Value = &quot;2003&quot;;<br />
                sheet.Range[&quot;A4&quot;].Value = &quot;2004&quot;;<br />
                sheet.Range[&quot;A5&quot;].Value = &quot;2005&quot;;<br />
                //Sales<br />
                sheet.Range[&quot;B1&quot;].Value = &quot;Sales&quot;;<br />
                sheet.Range[&quot;B2&quot;].NumberValue = 4000;<br />
                sheet.Range[&quot;B3&quot;].NumberValue = 6000;<br />
                sheet.Range[&quot;B4&quot;].NumberValue = 7000;<br />
                sheet.Range[&quot;B5&quot;].NumberValue = 8500;<br />
                //Style<br />
                sheet.Range[&quot;A1:B1&quot;].Style.Font.IsBold = true;<br />
                sheet.Range[&quot;A2:B2&quot;].Style.KnownColor = ExcelColors.LightYellow;<br />
                sheet.Range[&quot;A3:B3&quot;].Style.KnownColor = ExcelColors.LightGreen1;<br />
                sheet.Range[&quot;A4:B4&quot;].Style.KnownColor = ExcelColors.LightOrange;<br />
                sheet.Range[&quot;A5:B5&quot;].Style.KnownColor = ExcelColors.LightTurquoise;<br />
                //Border<br />
                sheet.Range[&quot;A1:B5&quot;].Style.Borders[BordersLineType.EdgeTop].Color = Color.FromArgb(0, 0, 128);<br />
                sheet.Range[&quot;A1:B5&quot;].Style.Borders[BordersLineType.EdgeTop].LineStyle = LineStyleType.Thin;<br />
                sheet.Range[&quot;A1:B5&quot;].Style.Borders[BordersLineType.EdgeBottom].Color = Color.FromArgb(0, 0, 128);<br />
                sheet.Range[&quot;A1:B5&quot;].Style.Borders[BordersLineType.EdgeBottom].LineStyle = LineStyleType.Thin;<br />
                sheet.Range[&quot;A1:B5&quot;].Style.Borders[BordersLineType.EdgeLeft].Color = Color.FromArgb(0, 0, 128);<br />
                sheet.Range[&quot;A1:B5&quot;].Style.Borders[BordersLineType.EdgeLeft].LineStyle = LineStyleType.Thin;<br />
                sheet.Range[&quot;A1:B5&quot;].Style.Borders[BordersLineType.EdgeRight].Color = Color.FromArgb(0, 0, 128);<br />
                sheet.Range[&quot;A1:B5&quot;].Style.Borders[BordersLineType.EdgeRight].LineStyle = LineStyleType.Thin;<br />
                //Number format<br />
                sheet.Range[&quot;B2:C5&quot;].Style.NumberFormat = &quot;\&quot;$\&quot;#,##0&quot;;<br />
                chart.PlotArea.Fill.Visible = false;<br />
                //Save the file<br />
                workbook.SaveToFile(&quot;Sample.xls&quot;);<br />
                //Launch the file<br />
                System.Diagnostics.Process.Start(&quot;Sample.xls&quot;);<br />
            }<br />
            catch (Exception)<br />
            {</p>
<p>                throw;<br />
            }<br />
        }<br />
[/csharp]</p>
<p><strong>VB.NET Code</strong></p>
<p>[vb]<br />
 &#8216;Create a new workbook<br />
        Dim workbook As New Workbook()<br />
        &#8216;Initialize worksheet<br />
        workbook.CreateEmptySheets(1)<br />
        Dim sheet As Worksheet = workbook.Worksheets(0)<br />
        &#8216;Set sheet name<br />
        sheet.Name = &quot;Chart data&quot;<br />
        &#8216;Set the grid lines invisible<br />
        sheet.GridLinesVisible = False<br />
        &#8216;Create a chart<br />
        Dim chart As Chart = sheet.Charts.Add(ExcelChartType.Pie3D)<br />
        &#8216;Set region of chart data<br />
        chart.DataRange = sheet.Range(&quot;B2:B5&quot;)<br />
        chart.SeriesDataFromRange = False<br />
        &#8216;Set position of chart<br />
        chart.LeftColumn = 1<br />
        chart.TopRow = 6<br />
        chart.RightColumn = 9<br />
        chart.BottomRow = 25<br />
        &#8216;Chart title<br />
        chart.ChartTitle = &quot;Sales by year&quot;<br />
        chart.ChartTitleArea.IsBold = True<br />
        chart.ChartTitleArea.Size = 12<br />
        &#8216;Set the chart<br />
        Dim cs As Spire.Xls.Charts.ChartSerie = chart.Series(0)<br />
        &#8216;Chart Labels resource<br />
        cs.CategoryLabels = sheet.Range(&quot;A2:A5&quot;)<br />
        &#8216;Chart value resource<br />
        cs.Values = sheet.Range(&quot;B2:B5&quot;)<br />
        &#8216;Set the value visible in the chart<br />
        cs.DataPoints.DefaultDataPoint.DataLabels.HasValue = True<br />
        &#8216;Year<br />
        sheet.Range(&quot;A1&quot;).Value = &quot;Year&quot;<br />
        sheet.Range(&quot;A2&quot;).Value = &quot;2002&quot;<br />
        sheet.Range(&quot;A3&quot;).Value = &quot;2003&quot;<br />
        sheet.Range(&quot;A4&quot;).Value = &quot;2004&quot;<br />
        sheet.Range(&quot;A5&quot;).Value = &quot;2005&quot;<br />
        &#8216;Sales<br />
        sheet.Range(&quot;B1&quot;).Value = &quot;Sales&quot;<br />
        sheet.Range(&quot;B2&quot;).NumberValue = 4000<br />
        sheet.Range(&quot;B3&quot;).NumberValue = 6000<br />
        sheet.Range(&quot;B4&quot;).NumberValue = 7000<br />
        sheet.Range(&quot;B5&quot;).NumberValue = 8500<br />
        &#8216;Style<br />
        sheet.Range(&quot;A1:B1&quot;).Style.Font.IsBold = True<br />
        sheet.Range(&quot;A2:B2&quot;).Style.KnownColor = ExcelColors.LightYellow<br />
        sheet.Range(&quot;A3:B3&quot;).Style.KnownColor = ExcelColors.LightGreen1<br />
        sheet.Range(&quot;A4:B4&quot;).Style.KnownColor = ExcelColors.LightOrange<br />
        sheet.Range(&quot;A5:B5&quot;).Style.KnownColor = ExcelColors.LightTurquoise<br />
        &#8216;Border<br />
        sheet.Range(&quot;A1:B5&quot;).Style.Borders(BordersLineType.EdgeTop).Color = Color.FromArgb(0, 0, 128)<br />
        sheet.Range(&quot;A1:B5&quot;).Style.Borders(BordersLineType.EdgeTop).LineStyle = LineStyleType.Thin<br />
        sheet.Range(&quot;A1:B5&quot;).Style.Borders(BordersLineType.EdgeBottom).Color = Color.FromArgb(0, 0, 128)<br />
        sheet.Range(&quot;A1:B5&quot;).Style.Borders(BordersLineType.EdgeBottom).LineStyle = LineStyleType.Thin<br />
        sheet.Range(&quot;A1:B5&quot;).Style.Borders(BordersLineType.EdgeLeft).Color = Color.FromArgb(0, 0, 128)<br />
        sheet.Range(&quot;A1:B5&quot;).Style.Borders(BordersLineType.EdgeLeft).LineStyle = LineStyleType.Thin<br />
        sheet.Range(&quot;A1:B5&quot;).Style.Borders(BordersLineType.EdgeRight).Color = Color.FromArgb(0, 0, 128)<br />
        sheet.Range(&quot;A1:B5&quot;).Style.Borders(BordersLineType.EdgeRight).LineStyle = LineStyleType.Thin<br />
        &#8216;Number format<br />
        sheet.Range(&quot;B2:C5&quot;).Style.NumberFormat = &quot;&quot;&quot;$&quot;&quot;#,##0&quot;<br />
        chart.PlotArea.Fill.Visible = False<br />
        &#8216;Save doc file.<br />
        workbook.SaveToFile(&quot;Sample.xls&quot;)<br />
        &#8216;Launch the MS Word file.<br />
        System.Diagnostics.Process.Start(&quot;Sample.xls&quot;)<br />
[/vb]</p>
<p>In the above lines code, we are creating a pie chart by giving some settings and data and load it. Now if you run you will get an output as follows.</p>
<p><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/Create_Charts_Using_SpireXLS-e1439222337541.png"><img fetchpriority="high" decoding="async" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/Create_Charts_Using_SpireXLS-e1439222337541.png" alt="Create_Charts_Using_SpireXLS" width="650" height="261" class="alignnone size-full wp-image-8761" srcset="/wp-content/uploads/2015/08/Create_Charts_Using_SpireXLS-e1439222337541.png 650w, /wp-content/uploads/2015/08/Create_Charts_Using_SpireXLS-e1439222337541-300x120.png 300w, /wp-content/uploads/2015/08/Create_Charts_Using_SpireXLS-e1439222337541-400x161.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a></p>
<p><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/Create_Charts_Using_SpireXLS_Output.png"><img decoding="async" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/Create_Charts_Using_SpireXLS_Output.png" alt="Create_Charts_Using_SpireXLS_Output" width="581" height="510" class="alignnone size-full wp-image-8771" srcset="/wp-content/uploads/2015/08/Create_Charts_Using_SpireXLS_Output.png 581w, /wp-content/uploads/2015/08/Create_Charts_Using_SpireXLS_Output-300x263.png 300w, /wp-content/uploads/2015/08/Create_Charts_Using_SpireXLS_Output-400x351.png 400w" sizes="(max-width: 581px) 100vw, 581px" /></a></p>
<p>In the above mentioned lines of codes, we are doing so many processes, those processes are listed below.</p>
<li>Creating a new workbook</li>
<li>Initialize worksheet newly created</li>
<li>Set sheet name of worksheet</li>
<li>Set the grid lines invisible</li>
<li>Creating a chart</li>
<li>Set region of chart data</li>
<li>Set position of chart</li>
<li>Set Chart title</li>
<li>Initialize the chart series</li>
<li>Setting Chart Labels resource</li>
<li>Setting Chart value resource</li>
<li>Set the value visible in the chart</li>
<li>Apply Styles</li>
<li>Apply Borders</li>
<li>Give Number format if necessary</li>
<li>Save the file</li>
<li>At last Launch the file</li>
<p>Wow!. That&#8217;s cool right?</p>
<p>Not yet finished!. There are so many things you can try with your sheet object. I suggest you to try those. You will get surprised.</p>
<div id="attachment_10031" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/Working_With_Charts_Using_Spire-e1440082383956.png"><img decoding="async" aria-describedby="caption-attachment-10031" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/Working_With_Charts_Using_Spire-e1440082383956.png" alt="Working With Charts Using Spire XLS Sheet Object" width="650" height="233" class="size-full wp-image-10031" srcset="/wp-content/uploads/2015/08/Working_With_Charts_Using_Spire-e1440082383956.png 650w, /wp-content/uploads/2015/08/Working_With_Charts_Using_Spire-e1440082383956-300x108.png 300w, /wp-content/uploads/2015/08/Working_With_Charts_Using_Spire-e1440082383956-400x143.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-10031" class="wp-caption-text">Working With Charts Using Spire XLS Sheet Object</p></div>
<div id="attachment_10041" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/Working_With_Charts_Using_Spire1-e1440082428977.png"><img decoding="async" aria-describedby="caption-attachment-10041" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/Working_With_Charts_Using_Spire1-e1440082428977.png" alt="Working With Charts Using Spire XLS Sheet Object" width="650" height="270" class="size-full wp-image-10041" srcset="/wp-content/uploads/2015/08/Working_With_Charts_Using_Spire1-e1440082428977.png 650w, /wp-content/uploads/2015/08/Working_With_Charts_Using_Spire1-e1440082428977-300x125.png 300w, /wp-content/uploads/2015/08/Working_With_Charts_Using_Spire1-e1440082428977-400x166.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-10041" class="wp-caption-text">Working With Charts Using Spire XLS Sheet Object</p></div>
<p>If you want you can set different chart types too, it will give you a great design in your chart. The most useful chart types which I uses is Bar3DClustered, 3DBubble, Bubble, Column3D and many more.</p>
<div id="attachment_10051" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/Working_With_Charts_Using_Spire_XLS_Chart_Object.png"><img decoding="async" aria-describedby="caption-attachment-10051" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/Working_With_Charts_Using_Spire_XLS_Chart_Object-e1440082676189.png" alt="Working_With_Charts_Using_Spire_XLS_Chart_Object" width="650" height="195" class="size-full wp-image-10051" srcset="/wp-content/uploads/2015/08/Working_With_Charts_Using_Spire_XLS_Chart_Object-e1440082676189.png 650w, /wp-content/uploads/2015/08/Working_With_Charts_Using_Spire_XLS_Chart_Object-e1440082676189-300x90.png 300w, /wp-content/uploads/2015/08/Working_With_Charts_Using_Spire_XLS_Chart_Object-e1440082676189-400x120.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-10051" class="wp-caption-text">Working_With_Charts_Using_Spire_XLS_Chart_Object</p></div>
<p>This product gives you many ways to make your chart in the way you like. There are plenty of options available to so so like you can set the Legend Position by using LegendPositionType property.</p>
<p>Next we will see how we can implement Column chart, what ever we have discusses will be same for every charts, but it may have some different properties which is strictly depends on the chart type. </p>
<p><strong>Column Chart</strong></p>
<p>Now we will create an another button and name it Column Chart. And in the button click you need to add the following codes.</p>
<p><strong>C# Code</strong></p>
<p>[csharp]<br />
private void button2_Click(object sender, EventArgs e)<br />
        {<br />
            try<br />
            {<br />
                //Load Workbook<br />
                Workbook workbook = new Workbook();<br />
                workbook.LoadFromFile(@&quot;D:\Sample.xlsx&quot;);<br />
                Worksheet sheet = workbook.Worksheets[0];<br />
                //Add Chart and Set Chart Data Range<br />
                Chart chart = sheet.Charts.Add(ExcelChartType.ColumnClustered);<br />
                chart.DataRange = sheet.Range[&quot;D1:E17&quot;];<br />
                chart.SeriesDataFromRange = false;<br />
                //Chart Position<br />
                chart.LeftColumn = 1;<br />
                chart.TopRow = 19;<br />
                chart.RightColumn = 8;<br />
                chart.BottomRow = 33;<br />
                //Chart Border<br />
                chart.ChartArea.Border.Weight = ChartLineWeightType.Medium;<br />
                chart.ChartArea.Border.Color = Color.SandyBrown;<br />
                //Chart Title<br />
                chart.ChartTitle = &quot;Parts Sales Info&quot;;<br />
                chart.ChartTitleArea.Font.FontName = &quot;Calibri&quot;;<br />
                chart.ChartTitleArea.Font.Size = 13;<br />
                chart.ChartTitleArea.Font.IsBold = true;<br />
                //Chart Axes<br />
                chart.PrimaryCategoryAxis.Title = &quot;Parts&quot;;<br />
                chart.PrimaryCategoryAxis.Font.Color = Color.Blue;<br />
                chart.PrimaryValueAxis.Title = &quot;Amounts&quot;;<br />
                chart.PrimaryValueAxis.HasMajorGridLines = false;<br />
                chart.PrimaryValueAxis.MaxValue = 350;<br />
                chart.PrimaryValueAxis.TitleArea.TextRotationAngle = 90;<br />
                //Chart Legend<br />
                chart.Legend.Position = LegendPositionType.Right;<br />
                //Save and Launch<br />
                workbook.SaveToFile(&quot;ExcelColumnChart.xlsx&quot;, ExcelVersion.Version2010);<br />
                System.Diagnostics.Process.Start(&quot;ExcelColumnChart.xlsx&quot;);</p>
<p>            }<br />
            catch (Exception)<br />
            {</p>
<p>                throw;<br />
            }<br />
        }<br />
[/csharp]</p>
<p><strong>VB.NET Code</strong></p>
<p>[vb]<br />
 &#8216;Load Workbook<br />
            Dim workbook As New Workbook()<br />
            workbook.LoadFromFile(&quot;E:\Sample.xlsx&quot;)<br />
            Dim sheet As Worksheet = workbook.Worksheets(0)<br />
            &#8216;Add Chart and Set Chart Data Range<br />
            Dim chart As Chart = sheet.Charts.Add(ExcelChartType.ColumnClustered)<br />
            chart.DataRange = sheet.Range(&quot;D1:E17&quot;)<br />
            chart.SeriesDataFromRange = False<br />
            &#8216;Chart Position<br />
            chart.LeftColumn = 1<br />
            chart.TopRow = 19<br />
            chart.RightColumn = 8<br />
            chart.BottomRow = 33<br />
            &#8216;Chart Border<br />
            chart.ChartArea.Border.Weight = ChartLineWeightType.Medium<br />
            chart.ChartArea.Border.Color = Color.SandyBrown<br />
            &#8216;Chart Title<br />
            chart.ChartTitle = &quot;Parts Sales Info&quot;<br />
            chart.ChartTitleArea.Font.FontName = &quot;Calibri&quot;<br />
            chart.ChartTitleArea.Font.Size = 13<br />
            chart.ChartTitleArea.Font.IsBold = True<br />
            &#8216;Chart Axes<br />
            chart.PrimaryCategoryAxis.Title = &quot;Parts&quot;<br />
            chart.PrimaryCategoryAxis.Font.Color = Color.Blue<br />
            chart.PrimaryValueAxis.Title = &quot;Amounts&quot;<br />
            chart.PrimaryValueAxis.HasMajorGridLines = False<br />
            chart.PrimaryValueAxis.MaxValue = 350<br />
            chart.PrimaryValueAxis.TitleArea.TextRotationAngle = 90<br />
            &#8216;Chart Legend<br />
            chart.Legend.Position = LegendPositionType.Right<br />
            &#8216;Save and Launch<br />
            workbook.SaveToFile(&quot;ExcelColumnChart.xlsx&quot;, ExcelVersion.Version2010)<br />
            System.Diagnostics.Process.Start(&quot;ExcelColumnChart.xlsx&quot;)</p>
<p>[/vb]</p>
<p>Now if you run the code, you can see an output as follows.</p>
<p><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/columnchart-e1439304127270.png"><img decoding="async" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/columnchart-e1439304127270.png" alt="columnchart" width="650" height="398" class="alignnone size-full wp-image-9061" srcset="/wp-content/uploads/2015/08/columnchart-e1439304127270.png 650w, /wp-content/uploads/2015/08/columnchart-e1439304127270-300x184.png 300w, /wp-content/uploads/2015/08/columnchart-e1439304127270-400x245.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a></p>
<p><strong>Excel Bar Chart</strong></p>
<p>Before going through you must add an new namespace as follows.</p>
<p>[csharp]<br />
using Spire.Xls.Charts;<br />
[/csharp]<br />
Now we will create an another button in our form and in the click event we will write the receding lines of codes.</p>
<p>[csharp]<br />
  private void button1_Click(object sender, EventArgs e)<br />
        {<br />
            try<br />
            {<br />
                Workbook workbook = new Workbook();<br />
                //Initailize worksheet<br />
                workbook.CreateEmptySheets(1);<br />
                Worksheet sheet = workbook.Worksheets[0];<br />
                sheet.Name = &quot;Chart data&quot;;<br />
                sheet.GridLinesVisible = false;<br />
                //Writes chart data<br />
                CreateChartData(sheet);<br />
                //Add a new  chart worsheet to workbook<br />
                Chart chart = sheet.Charts.Add();<br />
                //Set region of chart data<br />
                chart.DataRange = sheet.Range[&quot;A1:C5&quot;];<br />
                chart.SeriesDataFromRange = false;<br />
                //Set position of chart<br />
                chart.LeftColumn = 1;<br />
                chart.TopRow = 6;<br />
                chart.RightColumn = 11;<br />
                chart.BottomRow = 29;<br />
                chart.ChartType = ExcelChartType.Bar3DClustered;<br />
                //Chart title<br />
                chart.ChartTitle = &quot;Sales market by country&quot;;<br />
                chart.ChartTitleArea.IsBold = true;<br />
                chart.ChartTitleArea.Size = 12;<br />
                chart.PrimaryCategoryAxis.Title = &quot;Country&quot;;<br />
                chart.PrimaryCategoryAxis.Font.IsBold = true;<br />
                chart.PrimaryCategoryAxis.TitleArea.IsBold = true;<br />
                chart.PrimaryCategoryAxis.TitleArea.TextRotationAngle = 90;<br />
                chart.PrimaryValueAxis.Title = &quot;Sales(in Dollars)&quot;;<br />
                chart.PrimaryValueAxis.HasMajorGridLines = false;<br />
                chart.PrimaryValueAxis.MinValue = 1000;<br />
                chart.PrimaryValueAxis.TitleArea.IsBold = true;<br />
                foreach (ChartSerie cs in chart.Series)<br />
                {<br />
                    cs.Format.Options.IsVaryColor = true;<br />
                    cs.DataPoints.DefaultDataPoint.DataLabels.HasValue = true;<br />
                }<br />
                chart.Legend.Position = LegendPositionType.Top;<br />
                workbook.SaveToFile(&quot;Sample.xls&quot;);<br />
                ExcelDocViewer(workbook.FileName);</p>
<p>            }<br />
            catch (Exception)<br />
            {<br />
                throw;<br />
            }<br />
        }<br />
[/csharp]</p>
<p>As you can see we are calling a function <em>CreateChartData</em> to generate the data, so now we will write the function body.</p>
<p>[csharp]<br />
private void CreateChartData(Worksheet sheet)<br />
        {<br />
            //Country<br />
            sheet.Range[&quot;A1&quot;].Value = &quot;Country&quot;;<br />
            sheet.Range[&quot;A2&quot;].Value = &quot;Cuba&quot;;<br />
            sheet.Range[&quot;A3&quot;].Value = &quot;Mexico&quot;;<br />
            sheet.Range[&quot;A4&quot;].Value = &quot;France&quot;;<br />
            sheet.Range[&quot;A5&quot;].Value = &quot;German&quot;;<br />
            //Jun<br />
            sheet.Range[&quot;B1&quot;].Value = &quot;Jun&quot;;<br />
            sheet.Range[&quot;B2&quot;].NumberValue = 6000;<br />
            sheet.Range[&quot;B3&quot;].NumberValue = 8000;<br />
            sheet.Range[&quot;B4&quot;].NumberValue = 9000;<br />
            sheet.Range[&quot;B5&quot;].NumberValue = 8500;<br />
            //Jun<br />
            sheet.Range[&quot;C1&quot;].Value = &quot;Aug&quot;;<br />
            sheet.Range[&quot;C2&quot;].NumberValue = 3000;<br />
            sheet.Range[&quot;C3&quot;].NumberValue = 2000;<br />
            sheet.Range[&quot;C4&quot;].NumberValue = 2300;<br />
            sheet.Range[&quot;C5&quot;].NumberValue = 4200;<br />
            //Style<br />
            sheet.Range[&quot;A1:C1&quot;].Style.Font.IsBold = true;<br />
            sheet.Range[&quot;A2:C2&quot;].Style.KnownColor = ExcelColors.LightYellow;<br />
            sheet.Range[&quot;A3:C3&quot;].Style.KnownColor = ExcelColors.LightGreen1;<br />
            sheet.Range[&quot;A4:C4&quot;].Style.KnownColor = ExcelColors.LightOrange;<br />
            sheet.Range[&quot;A5:C5&quot;].Style.KnownColor = ExcelColors.LightTurquoise;<br />
            //Border<br />
            sheet.Range[&quot;A1:C5&quot;].Style.Borders[BordersLineType.EdgeTop].Color = Color.FromArgb(0, 0, 128);<br />
            sheet.Range[&quot;A1:C5&quot;].Style.Borders[BordersLineType.EdgeTop].LineStyle = LineStyleType.Thin;<br />
            sheet.Range[&quot;A1:C5&quot;].Style.Borders[BordersLineType.EdgeBottom].Color = Color.FromArgb(0, 0, 128);<br />
            sheet.Range[&quot;A1:C5&quot;].Style.Borders[BordersLineType.EdgeBottom].LineStyle = LineStyleType.Thin;<br />
            sheet.Range[&quot;A1:C5&quot;].Style.Borders[BordersLineType.EdgeLeft].Color = Color.FromArgb(0, 0, 128);<br />
            sheet.Range[&quot;A1:C5&quot;].Style.Borders[BordersLineType.EdgeLeft].LineStyle = LineStyleType.Thin;<br />
            sheet.Range[&quot;A1:C5&quot;].Style.Borders[BordersLineType.EdgeRight].Color = Color.FromArgb(0, 0, 128);<br />
            sheet.Range[&quot;A1:C5&quot;].Style.Borders[BordersLineType.EdgeRight].LineStyle = LineStyleType.Thin;<br />
            sheet.Range[&quot;B2:C5&quot;].Style.NumberFormat = &quot;\&quot;$\&quot;#,##0&quot;;<br />
        }<br />
[/csharp]</p>
<p>And we will use the preceding function for viewing our chart created.</p>
<p>[csharp]<br />
private void ExcelDocViewer(string fileName)<br />
        {<br />
            try<br />
            {<br />
                System.Diagnostics.Process.Start(fileName);<br />
            }<br />
            catch { }<br />
        }<br />
[/csharp]</p>
<p>Now it is time to run our program. You will see the output as follows.</p>
<div id="attachment_9071" style="width: 310px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/Excel_Bar_Chart.png"><img decoding="async" aria-describedby="caption-attachment-9071" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/Excel_Bar_Chart.png" alt="Excel Bar Chart" width="300" height="300" class="size-full wp-image-9071" srcset="/wp-content/uploads/2015/08/Excel_Bar_Chart.png 300w, /wp-content/uploads/2015/08/Excel_Bar_Chart-150x150.png 150w, /wp-content/uploads/2015/08/Excel_Bar_Chart-130x130.png 130w" sizes="(max-width: 300px) 100vw, 300px" /></a><p id="caption-attachment-9071" class="wp-caption-text">Excel Bar Chart</p></div>
<div id="attachment_9081" style="width: 669px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/Excel_Bar_Chart_Output.png"><img decoding="async" aria-describedby="caption-attachment-9081" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/Excel_Bar_Chart_Output.png" alt="Excel Bar Chart " width="659" height="458" class="size-full wp-image-9081" srcset="/wp-content/uploads/2015/08/Excel_Bar_Chart_Output.png 659w, /wp-content/uploads/2015/08/Excel_Bar_Chart_Output-300x208.png 300w, /wp-content/uploads/2015/08/Excel_Bar_Chart_Output-160x110.png 160w, /wp-content/uploads/2015/08/Excel_Bar_Chart_Output-400x278.png 400w" sizes="(max-width: 659px) 100vw, 659px" /></a><p id="caption-attachment-9081" class="wp-caption-text">Excel Bar Chart</p></div>
<p>As you can see it is very easy to give styles and border to our chart.</p>
<p>[csharp]<br />
//Style<br />
            sheet.Range[&quot;A1:C1&quot;].Style.Font.IsBold = true;<br />
            sheet.Range[&quot;A2:C2&quot;].Style.KnownColor = ExcelColors.LightYellow;<br />
            sheet.Range[&quot;A3:C3&quot;].Style.KnownColor = ExcelColors.LightGreen1;<br />
            sheet.Range[&quot;A4:C4&quot;].Style.KnownColor = ExcelColors.LightOrange;<br />
            sheet.Range[&quot;A5:C5&quot;].Style.KnownColor = ExcelColors.LightTurquoise;<br />
            //Border<br />
            sheet.Range[&quot;A1:C5&quot;].Style.Borders[BordersLineType.EdgeTop].Color = Color.FromArgb(0, 0, 128);<br />
            sheet.Range[&quot;A1:C5&quot;].Style.Borders[BordersLineType.EdgeTop].LineStyle = LineStyleType.Thin;<br />
            sheet.Range[&quot;A1:C5&quot;].Style.Borders[BordersLineType.EdgeBottom].Color = Color.FromArgb(0, 0, 128);<br />
            sheet.Range[&quot;A1:C5&quot;].Style.Borders[BordersLineType.EdgeBottom].LineStyle = LineStyleType.Thin;<br />
            sheet.Range[&quot;A1:C5&quot;].Style.Borders[BordersLineType.EdgeLeft].Color = Color.FromArgb(0, 0, 128);<br />
            sheet.Range[&quot;A1:C5&quot;].Style.Borders[BordersLineType.EdgeLeft].LineStyle = LineStyleType.Thin;<br />
            sheet.Range[&quot;A1:C5&quot;].Style.Borders[BordersLineType.EdgeRight].Color = Color.FromArgb(0, 0, 128);<br />
            sheet.Range[&quot;A1:C5&quot;].Style.Borders[BordersLineType.EdgeRight].LineStyle = LineStyleType.Thin;<br />
            sheet.Range[&quot;B2:C5&quot;].Style.NumberFormat = &quot;\&quot;$\&quot;#,##0&quot;;<br />
[/csharp]</p>
<p>Like this we can crate Line Chart, Radar Chart and many more. Please try those too. Now we will see How to Save Excel Charts as Images.</p>
<p><strong>How to Save Excel Charts as Images</strong></p>
<p>Create another button and write the preceding codes in button click.</p>
<p>[csharp]<br />
private void button2_Click(object sender, EventArgs e)<br />
        {<br />
            Workbook workbook = new Workbook();<br />
            workbook.LoadFromFile(&quot;D:\\Sample.xlsx&quot;, ExcelVersion.Version2010);<br />
            Worksheet sheet = workbook.Worksheets[0];<br />
            Image[] imgs = workbook.SaveChartAsImage(sheet);<br />
            for (int i = 0; i &lt; imgs.Length; i++)<br />
            {<br />
                imgs[i].Save(string.Format(&quot;img-{0}.png&quot;, i), System.Drawing.Imaging.ImageFormat.Png);<br />
            }</p>
<p>        }<br />
[/csharp]</p>
<p>Here we are taking a file called Sample.xlsx and loop through the charts inside the file and save those as images with few lines codes. Sounds good right?</p>
<p><strong>VB.Net Code</strong><br />
[vb]<br />
Dim workbook As New Workbook()<br />
workbook.LoadFromFile(&quot;D:\\Sample.xlsx&quot;, ExcelVersion.Version2010)<br />
Dim sheet As Worksheet = workbook.Worksheets(0)<br />
Dim imgs As Image() = workbook.SaveChartAsImage(sheet)<br />
For i As Integer = 0 To imgs.Length &#8211; 1<br />
    imgs(i).Save(String.Format(&quot;img-{0}.png&quot;, i), ImageFormat.Png)<br />
Next<br />
[/vb]</p>
<p><strong>Conclusion</strong></p>
<p>I hope you liked this article. Please share me your valuable suggestions and feedback.</p>
<p>Kindest Regards<br />
Sibeesh Venu</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sibeeshpassion.com/working-with-charts-using-spire-xls/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Client Side Chart Widget in HTML5: Part 5 (Polar Area Chart)</title>
		<link>https://sibeeshpassion.com/client-side-chart-widget-in-html5-part-5-polar-area-chart/</link>
					<comments>https://sibeeshpassion.com/client-side-chart-widget-in-html5-part-5-polar-area-chart/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Fri, 29 May 2015 19:53:38 +0000</pubDate>
				<category><![CDATA[HTML5]]></category>
		<category><![CDATA[chart]]></category>
		<category><![CDATA[HTML5 Chart]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Polar Area Chart]]></category>
		<guid isPermaLink="false">https://sibeeshpassion.com/?p=1111</guid>

					<description><![CDATA[Introduction I hope you have read my first two articles in this series that explains the loading of a Bar Chart, Pie Chart and Doughnut Chart. Please see the following links. Client-Side Chart Widget in HTML 5: Part 1 (Bar Chart) Client-Side Chart Widget in HTML 5: Part 2 (Pie Chart) Client-Side Chart Widget in HTML 5: Part 3 (Line Chart) Client-Side Chart Widget in HTML5: Part 4 (Doughnut Chart) Now we will explain a client-side Doughnut Chart widget in HTML5. Background Please download the necessary files here http://www.chartjs.org/. Using the code A simple HTML &#60;!DOCTYPE html&#62; &#60;html xmlns=&#8220;http://www.w3.org/1999/xhtml&#8221;&#62;    &#60;head&#62;        [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><strong>Introduction<br />
</strong><br />
I hope you have read my first two articles in this series that explains the loading of a Bar Chart, Pie Chart and Doughnut Chart. Please see the following links.</p>
<ul>
<li><a href="http://www.c-sharpcorner.com/UploadFile/65794e/client-side-chart-widget-in-html-5-part-1-bar-chart/">Client-Side Chart Widget in HTML 5: Part 1 (Bar Chart)</a></li>
<li><a href="http://www.c-sharpcorner.com/UploadFile/65794e/client-side-chart-widget-in-html-5-part-2-pie-chart/">Client-Side Chart Widget in HTML 5: Part 2 (Pie Chart)</a></li>
<li><a href="http://www.c-sharpcorner.com/UploadFile/65794e/client-side-chart-widget-in-html5-part-3-line-chart/">Client-Side Chart Widget in HTML 5: Part 3 (Line Chart)</a></li>
<li><a href="http://www.c-sharpcorner.com/UploadFile/65794e/client-side-chart-widget-in-html5-part-4-doughnut-chart/">Client-Side Chart Widget in HTML5: Part 4 (Doughnut Chart)</a></li>
</ul>
<p>Now we will explain a client-side Doughnut Chart widget in HTML5.</p>
<p><strong>Background<br />
</strong><br />
Please download the necessary files here <a href="http://www.chartjs.org/" rel="nofollow">http://www.chartjs.org/</a>.</p>
<p><strong>Using the code<br />
</strong><br />
<strong>A simple HTML<br />
</strong></p>
<div class="dp-highlighter">
<ol class="dp-xml">
<li class="alt">&lt;!DOCTYPE html<span class="tag">&gt;</span></li>
<li><span class="tag">&lt;</span><span class="tag-name">html</span> <span class="attribute">xmlns</span>=<span class="attribute-value">&#8220;http://www.w3.org/1999/xhtml&#8221;</span><span class="tag">&gt;</span></li>
<li class="alt"><span class="tag">   &lt;</span><span class="tag-name">head</span><span class="tag">&gt;</span></li>
<li>       <span class="tag">&lt;</span><span class="tag-name">title</span><span class="tag">&gt;</span> Polar Area Chart Using Chart.js<span class="tag">&lt;/</span><span class="tag-name">title</span><span class="tag">&gt;</span></li>
<li class="alt"><span class="tag">   &lt;/</span><span class="tag-name">head</span><span class="tag">&gt;</span></li>
<li><span class="tag">   &lt;</span><span class="tag-name">body</span><span class="tag">&gt;</span><span class="tag">&lt;/</span><span class="tag-name">body</span><span class="tag">&gt;</span></li>
<li class="alt"><span class="tag">&lt;/</span><span class="tag-name">html</span><span class="tag">&gt;</span></li>
</ol>
</div>
<p><strong>Included JavaScript file</strong></p>
<div class="dp-highlighter">
<ol class="dp-xml">
<li class="alt"><span class="tag">&lt;</span><span class="tag-name">script</span> <span class="attribute">src</span>=<span class="attribute-value">&#8220;Chart.js&#8221;</span><span class="tag">&gt;</span><span class="tag">&lt;/</span><span class="tag-name">script</span><span class="tag">&gt;</span></li>
</ol>
</div>
<p><strong>Call the Chart Function</strong></p>
<div class="dp-highlighter">
<ol class="dp-xml">
<li class="alt"><span class="attribute">window.onload</span> = <span class="attribute-value">function</span> () {</li>
<li>            var <span class="attribute">canvasObject</span> = <span class="attribute-value">document</span>.getElementById(&#8220;myChart&#8221;).getContext(&#8220;2d&#8221;);</li>
<li class="alt">            <span class="attribute">window.myPolarArea</span> = <span class="attribute-value">new</span> Chart(canvasObject).PolarArea(polarChartData, {</li>
<li>                responsive: true</li>
<li class="alt">            });</li>
<li>        }</li>
</ol>
</div>
<p>Here we are loading the chart in the myChart.</p>
<p>As you can see in the preceding code, polarChartData is the data we will load into the chart.</p>
<div class="dp-highlighter">
<ol class="dp-xml">
<li class="alt">var <span class="attribute">polarChartData</span> = [</li>
<li>    {</li>
<li class="alt">        value: 200,</li>
<li>        color: &#8220;#F7464A&#8221;,</li>
<li class="alt">        highlight: &#8220;#FF5A5E&#8221;,</li>
<li>        label: &#8220;Monday&#8221;</li>
<li class="alt">    },</li>
<li>    {</li>
<li class="alt">        value: 50,</li>
<li>        color: &#8220;#46BFBD&#8221;,</li>
<li class="alt">        highlight: &#8220;#5AD3D1&#8221;,</li>
<li>        label: &#8220;Tuesday&#8221;</li>
<li class="alt">    },</li>
<li>    {</li>
<li class="alt">        value: 150,</li>
<li>        color: &#8220;#FDB45C&#8221;,</li>
<li class="alt">        highlight: &#8220;#FFC870&#8221;,</li>
<li>        label: &#8220;Wednesday&#8221;</li>
<li class="alt">    },</li>
<li>    {</li>
<li class="alt">        value: 20,</li>
<li>        color: &#8220;#949FB1&#8221;,</li>
<li class="alt">        highlight: &#8220;#A8B3C5&#8221;,</li>
<li>        label: &#8220;Saturday&#8221;</li>
<li class="alt">    },</li>
<li>    {</li>
<li class="alt">        value: 400,</li>
<li>        color: &#8220;#4D5360&#8221;,</li>
<li class="alt">        highlight: &#8220;#616774&#8221;,</li>
<li>        label: &#8220;Sunday&#8221;</li>
<li class="alt">    }</li>
<li></li>
<li class="alt">                 ];</li>
</ol>
</div>
<p><strong>Properties</strong></p>
<ul>
<li>value</li>
<li>color</li>
<li>highlight</li>
<li>label</li>
</ul>
<p>Here you can change the properties as you want.</p>
<p><strong>Complete HTML<br />
</strong></p>
<div class="dp-highlighter">
<ol class="dp-xml">
<li class="alt">&lt;!DOCTYPE html<span class="tag">&gt;</span></li>
<li><span class="tag">&lt;</span><span class="tag-name">html</span> <span class="attribute">xmlns</span>=<span class="attribute-value">&#8220;http://www.w3.org/1999/xhtml&#8221;</span><span class="tag">&gt;</span></li>
<li class="alt"><span class="tag">&lt;</span><span class="tag-name">head</span><span class="tag">&gt;</span></li>
<li>    <span class="tag">&lt;</span><span class="tag-name">title</span><span class="tag">&gt;</span>Doughnut Chart Using Chart.js<span class="tag">&lt;/</span><span class="tag-name">title</span><span class="tag">&gt;</span></li>
<li class="alt">    <span class="tag">&lt;</span><span class="tag-name">script</span> <span class="attribute">src</span>=<span class="attribute-value">&#8220;Chart.js&#8221;</span><span class="tag">&gt;</span><span class="tag">&lt;/</span><span class="tag-name">script</span><span class="tag">&gt;</span></li>
<li>    <span class="tag">&lt;</span><span class="tag-name">script</span><span class="tag">&gt;</span></li>
<li class="alt">        var <span class="attribute">polarChartData</span> = [</li>
<li>                {</li>
<li class="alt">                    value: 200,</li>
<li>                    color: &#8220;#F7464A&#8221;,</li>
<li class="alt">                    highlight: &#8220;#FF5A5E&#8221;,</li>
<li>                    label: &#8220;Monday&#8221;</li>
<li class="alt">                },</li>
<li>                {</li>
<li class="alt">                    value: 50,</li>
<li>                    color: &#8220;#46BFBD&#8221;,</li>
<li class="alt">                    highlight: &#8220;#5AD3D1&#8221;,</li>
<li>                    label: &#8220;Tuesday&#8221;</li>
<li class="alt">                },</li>
<li>                {</li>
<li class="alt">                    value: 150,</li>
<li>                    color: &#8220;#FDB45C&#8221;,</li>
<li class="alt">                    highlight: &#8220;#FFC870&#8221;,</li>
<li>                    label: &#8220;Wednesday&#8221;</li>
<li class="alt">                },</li>
<li>                {</li>
<li class="alt">                    value: 20,</li>
<li>                    color: &#8220;#949FB1&#8221;,</li>
<li class="alt">                    highlight: &#8220;#A8B3C5&#8221;,</li>
<li>                    label: &#8220;Saturday&#8221;</li>
<li class="alt">                },</li>
<li>                {</li>
<li class="alt">                    value: 400,</li>
<li>                    color: &#8220;#4D5360&#8221;,</li>
<li class="alt">                    highlight: &#8220;#616774&#8221;,</li>
<li>                    label: &#8220;Sunday&#8221;</li>
<li class="alt">                }</li>
<li></li>
<li class="alt">        ];</li>
<li></li>
<li class="alt">        <span class="attribute">window.onload</span> = <span class="attribute-value">function</span> () {</li>
<li>            var <span class="attribute">canvasObject</span> = <span class="attribute-value">document</span>.getElementById(&#8220;myChart&#8221;).getContext(&#8220;2d&#8221;);</li>
<li class="alt">            <span class="attribute">window.myPolarArea</span> = <span class="attribute-value">new</span> Chart(canvasObject).PolarArea(polarChartData, {</li>
<li>                responsive: true</li>
<li class="alt">            });</li>
<li>        }</li>
<li class="alt"></li>
<li>    <span class="tag">&lt;/</span><span class="tag-name">script</span><span class="tag">&gt;</span></li>
<li class="alt"><span class="tag">&lt;/</span><span class="tag-name">head</span><span class="tag">&gt;</span></li>
<li><span class="tag">&lt;</span><span class="tag-name">body</span><span class="tag">&gt;</span></li>
<li class="alt">    <span class="tag">&lt;</span><span class="tag-name">div</span><span class="tag">&gt;</span></li>
<li>        Polar Area Chart @ <span class="tag">&lt;</span><span class="tag-name">a</span> <span class="attribute">href</span>=<span class="attribute-value">&#8220;www.sibeeshpassion.com&#8221;</span><span class="tag">&gt;</span>Sibeesh Passion<span class="tag">&lt;/</span><span class="tag-name">a</span><span class="tag">&gt;</span></li>
<li class="alt">        <span class="tag">&lt;</span><span class="tag-name">canvas</span> <span class="attribute">id</span>=<span class="attribute-value">&#8220;myChart&#8221;</span><span class="tag">&gt;</span><span class="tag">&lt;/</span><span class="tag-name">canvas</span><span class="tag">&gt;</span></li>
<li>    <span class="tag">&lt;/</span><span class="tag-name">div</span><span class="tag">&gt;</span></li>
<li class="alt"><span class="tag">&lt;/</span><span class="tag-name">body</span><span class="tag">&gt;</span></li>
<li><span class="tag">&lt;/</span><span class="tag-name">html</span><span class="tag">&gt;</span></li>
</ol>
</div>
<p><strong>Conclusion<br />
</strong><br />
I hope you can now create your own chart.</p>
<p><strong>Output</p>
<p><img decoding="async" src="http://www.c-sharpcorner.com/UploadFile/65794e/client-side-chart-widget-in-html5-part-5-polar-area-chart/Images/Output.jpg" alt="Output" /></strong></p>
]]></content:encoded>
					
					<wfw:commentRss>https://sibeeshpassion.com/client-side-chart-widget-in-html5-part-5-polar-area-chart/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Client Side Chart Widget in HTML 5: Part 3 (Line Chart)</title>
		<link>https://sibeeshpassion.com/client-side-chart-widget-in-html-5-part-3-line-chart/</link>
					<comments>https://sibeeshpassion.com/client-side-chart-widget-in-html-5-part-3-line-chart/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Fri, 29 May 2015 19:51:17 +0000</pubDate>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[chart]]></category>
		<category><![CDATA[HTML5 Chart]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Line Chart]]></category>
		<guid isPermaLink="false">https://sibeeshpassion.com/?p=1061</guid>

					<description><![CDATA[Introduction I hope you have read my first two articles in this series that explains about loading a Bar chart and Pie chart. If you have not read them then please see the following links. Client-Side Chart Widget in HTML 5: Part 1 (Bar Chart) Client-Side Chart Widget in HTML 5: Part 2 (Pie Chart) Now we will explain a client-side line chart widget in HTML5. Background Please download the necessary files here. Using the code A simple HTML &#60;!DOCTYPE html&#62; &#60;html xmlns=&#8220;http://www.w3.org/1999/xhtml&#8221;&#62; &#60;head&#62;     &#60;title&#62;Line Chart Using Chart.js&#60;/title&#62; &#60;/head&#62; &#60;body&#62;&#60;/body&#62; &#60;/html&#62; Included JavaScript file &#60;script src=&#8220;Chart.js&#8221;&#62;&#60;/script&#62; Call the Chart Function window.onload = function () {         var canvasObject = document.getElementById(&#8220;myChart&#8221;).getContext(&#8220;2d&#8221;);         window.myLine = new Chart(canvasObject).Line(lineChartData, {             responsive: true         });     } Here [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><strong>Introduction<br />
</strong><br />
I hope you have read my first two articles in this series that explains about loading a Bar chart and Pie chart. If you have not read them then please see the following links.</p>
<ul>
<li><span style="color: #0000ff;"><a href="http://www.c-sharpcorner.com/UploadFile/65794e/client-side-chart-widget-in-html-5-part-1-bar-chart/">Client-Side Chart Widget in HTML 5: Part 1 (Bar Chart)</a></span></li>
<li><span style="color: #0000ff;"><a href="http://www.c-sharpcorner.com/UploadFile/65794e/client-side-chart-widget-in-html-5-part-2-pie-chart/">Client-Side Chart Widget in HTML 5: Part 2 (Pie Chart)</a></span></li>
</ul>
<p>Now we will explain a client-side line chart widget in HTML5.</p>
<p><strong>Background<br />
</strong><br />
Please download the necessary files <a href="http://www.chartjs.org/" rel="nofollow">here</a>.</p>
<p><strong>Using the code<br />
</strong><br />
<strong>A simple HTML</strong></p>
<div class="dp-highlighter">
<div class="bar"></div>
<ol class="dp-c">
<li class="alt">&lt;!DOCTYPE html&gt;</li>
<li>&lt;html xmlns=<span class="string">&#8220;http://www.w3.org/1999/xhtml&#8221;</span>&gt;</li>
<li class="alt">&lt;head&gt;</li>
<li>    &lt;title&gt;Line Chart Using Chart.js&lt;/title&gt;</li>
<li class="alt">&lt;/head&gt;</li>
<li>&lt;body&gt;&lt;/body&gt;</li>
<li class="alt">&lt;/html&gt;</li>
</ol>
</div>
<p><strong>Included JavaScript file</strong></p>
<div class="dp-highlighter">
<div class="bar"></div>
<ol class="dp-c">
<li class="alt">&lt;script src=<span class="string">&#8220;Chart.js&#8221;</span>&gt;&lt;/script&gt;</li>
</ol>
</div>
<p><strong>Call the Chart Function</strong></p>
<div class="dp-highlighter">
<div class="bar"></div>
<ol class="dp-c">
<li class="alt">window.onload = <span class="keyword">function</span> () {</li>
<li>        <span class="keyword">var</span> canvasObject = document.getElementById(<span class="string">&#8220;myChart&#8221;</span>).getContext(<span class="string">&#8220;2d&#8221;</span>);</li>
<li class="alt">        window.myLine = <span class="keyword">new</span> Chart(canvasObject).Line(lineChartData, {</li>
<li>            responsive: <span class="keyword">true</span></li>
<li class="alt">        });</li>
<li>    }</li>
</ol>
</div>
<p>Here we are loading the chart into myChart.</p>
<p>As you can see in the preceding code, lineChartData is the data we will load into the chart.</p>
<div class="dp-highlighter">
<div class="bar"></div>
<ol class="dp-c">
<li class="alt"><span class="keyword">var</span> lineChartData = {</li>
<li>        labels: [<span class="string">&#8220;Monday&#8221;</span>, <span class="string">&#8220;Tuesday&#8221;</span>, <span class="string">&#8220;Wednesday&#8221;</span>, <span class="string">&#8220;Thursday&#8221;</span>, <span class="string">&#8220;Friday&#8221;</span>, <span class="string">&#8220;Saturday&#8221;</span>, <span class="string">&#8220;Sunday&#8221;</span>],</li>
<li class="alt">        datasets: [</li>
<li>                {</li>
<li class="alt">                    label: <span class="string">&#8220;My First dataset&#8221;</span>,</li>
<li>                    fillColor: <span class="string">&#8220;rgba(220,220,220,0.2)&#8221;</span>,</li>
<li class="alt">                    strokeColor: <span class="string">&#8220;rgba(220,220,220,1)&#8221;</span>,</li>
<li>                    pointColor: <span class="string">&#8220;rgba(220,220,220,1)&#8221;</span>,</li>
<li class="alt">                    pointStrokeColor: <span class="string">&#8220;#fff&#8221;</span>,</li>
<li>                    pointHighlightFill: <span class="string">&#8220;#fff&#8221;</span>,</li>
<li class="alt">                    pointHighlightStroke: <span class="string">&#8220;rgba(220,220,220,1)&#8221;</span>,</li>
<li>                    data: [scalingFactor(), scalingFactor(), scalingFactor(), scalingFactor(), scalingFactor(), scalingFactor(), scalingFactor()]</li>
<li class="alt">                },</li>
<li>                {</li>
<li class="alt">                    label: <span class="string">&#8220;My Second dataset&#8221;</span>,</li>
<li>                    fillColor: <span class="string">&#8220;rgba(151,187,205,0.2)&#8221;</span>,</li>
<li class="alt">                    strokeColor: <span class="string">&#8220;rgba(151,187,205,1)&#8221;</span>,</li>
<li>                    pointColor: <span class="string">&#8220;rgba(151,187,205,1)&#8221;</span>,</li>
<li class="alt">                    pointStrokeColor: <span class="string">&#8220;#fff&#8221;</span>,</li>
<li>                    pointHighlightFill: <span class="string">&#8220;#fff&#8221;</span>,</li>
<li class="alt">                    pointHighlightStroke: <span class="string">&#8220;rgba(151,187,205,1)&#8221;</span>,</li>
<li>                    data: [scalingFactor(), scalingFactor(), scalingFactor(), scalingFactor(), scalingFactor(), scalingFactor(), scalingFactor()]</li>
<li class="alt">                }</li>
<li>        ]</li>
<li class="alt"></li>
<li>    }</li>
</ol>
</div>
<p><strong>Properties</strong></p>
<ul>
<li>Labels</li>
<li>Datasets
<ol>
<li>fillColor</li>
<li>strokeColor</li>
<li>pointColor</li>
<li>pointStrokeColor</li>
<li>pointHighlightFill</li>
<li>pointHighlightStroke</li>
<li>data</li>
</ol>
</li>
</ul>
<p>Here you can change the properties as you want.</p>
<p><strong>To generate data</strong></p>
<div class="dp-highlighter">
<div class="bar"></div>
<ol class="dp-c">
<li class="alt"><span class="keyword">var</span> scalingFactor = <span class="keyword">function</span> () { <span class="keyword">return</span> Math.round(Math.random() * 100) };</li>
</ol>
</div>
<p><strong>Complete HTML</strong></p>
<div class="dp-highlighter">
<div class="bar"></div>
<ol class="dp-c">
<li class="alt">&lt;!DOCTYPE html&gt;</li>
<li>&lt;html xmlns=<span class="string">&#8220;http://www.w3.org/1999/xhtml&#8221;</span>&gt;</li>
<li class="alt">&lt;head&gt;</li>
<li>    &lt;title&gt;Line Chart Using Chart.js&lt;/title&gt;</li>
<li class="alt">    &lt;script src=<span class="string">&#8220;Chart.js&#8221;</span>&gt;&lt;/script&gt;</li>
<li>    &lt;script&gt;</li>
<li class="alt">    <span class="keyword">var</span> scalingFactor = <span class="keyword">function</span> () { <span class="keyword">return</span> Math.round(Math.random() * 100) };</li>
<li>    <span class="keyword">var</span> lineChartData = {</li>
<li class="alt">        labels: [<span class="string">&#8220;Monday&#8221;</span>, <span class="string">&#8220;Tuesday&#8221;</span>, <span class="string">&#8220;Wednesday&#8221;</span>, <span class="string">&#8220;Thursday&#8221;</span>, <span class="string">&#8220;Friday&#8221;</span>, <span class="string">&#8220;Saturday&#8221;</span>, <span class="string">&#8220;Sunday&#8221;</span>],</li>
<li>        datasets: [</li>
<li class="alt">                {</li>
<li>                    fillColor: <span class="string">&#8220;rgba(220,220,220,0.2)&#8221;</span>,</li>
<li class="alt">                    strokeColor: <span class="string">&#8220;rgba(220,220,220,1)&#8221;</span>,</li>
<li>                    pointColor: <span class="string">&#8220;rgba(220,220,220,1)&#8221;</span>,</li>
<li class="alt">                    pointStrokeColor: <span class="string">&#8220;#fff&#8221;</span>,</li>
<li>                    pointHighlightFill: <span class="string">&#8220;#fff&#8221;</span>,</li>
<li class="alt">                    pointHighlightStroke: <span class="string">&#8220;rgba(220,220,220,1)&#8221;</span>,</li>
<li>                    data: [scalingFactor(), scalingFactor(), scalingFactor(), scalingFactor(), scalingFactor(), scalingFactor(), scalingFactor()]</li>
<li class="alt">                }</li>
<li>        ]</li>
<li class="alt"></li>
<li>    }</li>
<li class="alt">    window.onload = <span class="keyword">function</span> () {</li>
<li>        <span class="keyword">var</span> canvasObject = document.getElementById(<span class="string">&#8220;myChart&#8221;</span>).getContext(<span class="string">&#8220;2d&#8221;</span>);</li>
<li class="alt">        window.myLine = <span class="keyword">new</span> Chart(canvasObject).Line(lineChartData, {</li>
<li>            responsive: <span class="keyword">true</span></li>
<li class="alt">        });</li>
<li>    }</li>
<li class="alt"></li>
<li>    &lt;/script&gt;</li>
<li class="alt">&lt;/head&gt;</li>
<li>&lt;body&gt;</li>
<li class="alt">    &lt;div&gt;</li>
<li>        &lt;canvas id=<span class="string">&#8220;myChart&#8221;</span>&gt;&lt;/canvas&gt;</li>
<li class="alt">    &lt;/div&gt;</li>
<li>&lt;/body&gt;</li>
<li class="alt">&lt;/html&gt;</li>
</ol>
</div>
<p><strong>Conclusion<br />
</strong><br />
I hope you have created your own chart.</p>
<p><strong>Output</p>
<p><img decoding="async" src="http://www.c-sharpcorner.com/UploadFile/65794e/client-side-chart-widget-in-html5-part-3-line-chart/Images/Output.jpg" alt="Output" /></strong></p>
]]></content:encoded>
					
					<wfw:commentRss>https://sibeeshpassion.com/client-side-chart-widget-in-html-5-part-3-line-chart/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Client-Side Chart Widget in HTML 5: Part 2 (Pie Chart)</title>
		<link>https://sibeeshpassion.com/client-side-chart-widget-in-html-5-part-2-pie-chart/</link>
					<comments>https://sibeeshpassion.com/client-side-chart-widget-in-html-5-part-2-pie-chart/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Fri, 29 May 2015 19:48:02 +0000</pubDate>
				<category><![CDATA[HTML5]]></category>
		<category><![CDATA[chart]]></category>
		<category><![CDATA[HTML5 Chart]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Pie Chart]]></category>
		<guid isPermaLink="false">https://sibeeshpassion.com/?p=1012</guid>

					<description><![CDATA[Introduction Hi all, I hope you are fine. I hope you have read my first part of this series that explains about loading the Bar Chart. Today we will explain a client-side Pie Chart widget in HTML5. Background As you need, you need to download the files. Please download the necessary files from here. Using the code A simple HTML &#60;!DOCTYPE html&#62; &#60;html xmlns=&#8220;http://www.w3.org/1999/xhtml&#8221;&#62;    &#60;head&#62;        &#60;title&#62;Pie Chart Using Chart.js&#60;/title&#62;    &#60;/head&#62;    &#60;body&#62;&#60;/body&#62; &#60;/html&#62; Included JavaScript file &#60;script src=&#8220;Chart.js&#8221;&#62;&#60;/script&#62; Call the Chart Function window.onload = function () {         var canvasObject = document.getElementById(&#8220;myChart&#8221;).getContext(&#8220;2d&#8221;);         window.myPie = new Chart(canvasObject).Pie(pieChartData);     } Here we are loading the chart in myChart. As you can see in the preceding code, pieChartData is the data we will [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><strong>Introduction</strong></p>
<p>Hi all, I hope you are fine. I hope you have read my <a href="http://www.c-sharpcorner.com/uploadfile/65794e/client-side-chart-widget-in-html-5-part-1-bar-chart/">first part</a> of this series that explains about loading the Bar Chart. Today we will explain a client-side Pie Chart widget in HTML5.</p>
<p><strong>Background<br />
</strong><br />
As you need, you need to download the files. Please download the necessary files from <a href="http://www.chartjs.org/" rel="nofollow">here</a>.</p>
<p><strong>Using the code<br />
</strong><br />
<strong>A simple HTML</strong></p>
<div class="dp-highlighter">
<div class="bar"></div>
<ol class="dp-c">
<li class="alt">&lt;!DOCTYPE html&gt;</li>
<li>&lt;html xmlns=<span class="string">&#8220;http://www.w3.org/1999/xhtml&#8221;</span>&gt;</li>
<li class="alt">   &lt;head&gt;</li>
<li>       &lt;title&gt;Pie Chart Using Chart.js&lt;/title&gt;</li>
<li class="alt">   &lt;/head&gt;</li>
<li>   &lt;body&gt;&lt;/body&gt;</li>
<li class="alt">&lt;/html&gt;</li>
</ol>
</div>
<p><strong>Included JavaScript file</strong></p>
<div class="dp-highlighter">
<div class="bar"></div>
<ol class="dp-c">
<li class="alt">&lt;script src=<span class="string">&#8220;Chart.js&#8221;</span>&gt;&lt;/script&gt;</li>
</ol>
</div>
<p><strong>Call the Chart Function</strong></p>
<div class="dp-highlighter">
<div class="bar"></div>
<ol class="dp-c">
<li class="alt">window.onload = <span class="keyword">function</span> () {</li>
<li>        <span class="keyword">var</span> canvasObject = document.getElementById(<span class="string">&#8220;myChart&#8221;</span>).getContext(<span class="string">&#8220;2d&#8221;</span>);</li>
<li class="alt">        window.myPie = <span class="keyword">new</span> Chart(canvasObject).Pie(pieChartData);</li>
<li>    }</li>
</ol>
</div>
<p>Here we are loading the chart in myChart.</p>
<p>As you can see in the preceding code, pieChartData is the data we will load into the chart.</p>
<div class="dp-highlighter">
<div class="bar"></div>
<ol class="dp-c">
<li class="alt"><span class="keyword">var</span> pieChartData = [</li>
<li>                {</li>
<li class="alt">                    value: 600,</li>
<li>                    color: <span class="string">&#8220;#F7464A&#8221;</span>,</li>
<li class="alt">                    highlight: <span class="string">&#8220;#FF5A5E&#8221;</span>,</li>
<li>                    label: <span class="string">&#8220;Monday&#8221;</span></li>
<li class="alt">                },</li>
<li>                {</li>
<li class="alt">                    value: 150,</li>
<li>                    color: <span class="string">&#8220;#46BFBD&#8221;</span>,</li>
<li class="alt">                    highlight: <span class="string">&#8220;#5AD3D1&#8221;</span>,</li>
<li>                    label: <span class="string">&#8220;Tuesday&#8221;</span></li>
<li class="alt">                },</li>
<li>                {</li>
<li class="alt">                    value: 100,</li>
<li>                    color: <span class="string">&#8220;#FDB45C&#8221;</span>,</li>
<li class="alt">                    highlight: <span class="string">&#8220;#FFC870&#8221;</span>,</li>
<li>                    label: <span class="string">&#8220;Wednesday&#8221;</span></li>
<li class="alt">                },</li>
<li>                {</li>
<li class="alt">                    value: 400,</li>
<li>                    color: <span class="string">&#8220;#949FB1&#8221;</span>,</li>
<li class="alt">                    highlight: <span class="string">&#8220;#A8B3C5&#8221;</span>,</li>
<li>                    label: <span class="string">&#8220;Thursday&#8221;</span></li>
<li class="alt">                },</li>
<li>                {</li>
<li class="alt">                    value: 120,</li>
<li>                    color: <span class="string">&#8220;#4D5360&#8221;</span>,</li>
<li class="alt">                    highlight: <span class="string">&#8220;#616774&#8221;</span>,</li>
<li>                    label: <span class="string">&#8220;Friday&#8221;</span></li>
<li class="alt">                }</li>
<li></li>
<li class="alt">    ];</li>
</ol>
</div>
<p><strong>Properties</strong></p>
<ul>
<li>value</li>
<li>color</li>
<li>highlight</li>
<li>label</li>
</ul>
<p>Here you can change the properties as you want.</p>
<p><strong>Complete HTML<br />
</strong></p>
<div class="dp-highlighter">
<div class="bar"></div>
<ol class="dp-c">
<li class="alt">&lt;!DOCTYPE html&gt;</li>
<li>&lt;html xmlns=<span class="string">&#8220;http://www.w3.org/1999/xhtml&#8221;</span>&gt;</li>
<li class="alt">&lt;head&gt;</li>
<li>    &lt;title&gt;Pie Chart Using Chart.js&lt;/title&gt;</li>
<li class="alt">    &lt;script src=<span class="string">&#8220;Chart.js&#8221;</span>&gt;&lt;/script&gt;</li>
<li>    &lt;script&gt;</li>
<li class="alt">    <span class="keyword">var</span> pieChartData = [</li>
<li>                {</li>
<li class="alt">                    value: 600,</li>
<li>                    color: <span class="string">&#8220;#F7464A&#8221;</span>,</li>
<li class="alt">                    highlight: <span class="string">&#8220;#FF5A5E&#8221;</span>,</li>
<li>                    label: <span class="string">&#8220;Monday&#8221;</span></li>
<li class="alt">                },</li>
<li>                {</li>
<li class="alt">                    value: 150,</li>
<li>                    color: <span class="string">&#8220;#46BFBD&#8221;</span>,</li>
<li class="alt">                    highlight: <span class="string">&#8220;#5AD3D1&#8221;</span>,</li>
<li>                    label: <span class="string">&#8220;Tuesday&#8221;</span></li>
<li class="alt">                },</li>
<li>                {</li>
<li class="alt">                    value: 100,</li>
<li>                    color: <span class="string">&#8220;#FDB45C&#8221;</span>,</li>
<li class="alt">                    highlight: <span class="string">&#8220;#FFC870&#8221;</span>,</li>
<li>                    label: <span class="string">&#8220;Wednesday&#8221;</span></li>
<li class="alt">                },</li>
<li>                {</li>
<li class="alt">                    value: 400,</li>
<li>                    color: <span class="string">&#8220;#949FB1&#8221;</span>,</li>
<li class="alt">                    highlight: <span class="string">&#8220;#A8B3C5&#8221;</span>,</li>
<li>                    label: <span class="string">&#8220;Thursday&#8221;</span></li>
<li class="alt">                },</li>
<li>                {</li>
<li class="alt">                    value: 120,</li>
<li>                    color: <span class="string">&#8220;#4D5360&#8221;</span>,</li>
<li class="alt">                    highlight: <span class="string">&#8220;#616774&#8221;</span>,</li>
<li>                    label: <span class="string">&#8220;Friday&#8221;</span></li>
<li class="alt">                }</li>
<li></li>
<li class="alt">    ];</li>
<li>    window.onload = <span class="keyword">function</span> () {</li>
<li class="alt">        <span class="keyword">var</span> canvasObject = document.getElementById(<span class="string">&#8220;myChart&#8221;</span>).getContext(<span class="string">&#8220;2d&#8221;</span>);</li>
<li>        window.myPie = <span class="keyword">new</span> Chart(canvasObject).Pie(pieChartData);</li>
<li class="alt"></li>
<li>    }</li>
<li class="alt"></li>
<li>    &lt;/script&gt;</li>
<li class="alt">&lt;/head&gt;</li>
<li>&lt;body&gt;</li>
<li class="alt">    &lt;div&gt;</li>
<li>        &lt;canvas id=<span class="string">&#8220;myChart&#8221;</span>&gt;&lt;/canvas&gt;</li>
<li class="alt">    &lt;/div&gt;</li>
<li>&lt;/body&gt;</li>
<li class="alt">&lt;/html&gt;</li>
</ol>
</div>
<p><strong>Conclusion<br />
</strong><br />
I hope you can now create your own chart.</p>
<p><strong>Output</strong></p>
<p><img decoding="async" src="http://www.c-sharpcorner.com/UploadFile/65794e/client-side-chart-widget-in-html-5-part-2-pie-chart/Images/Output.jpg" alt="" /></p>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sibeeshpassion.com/client-side-chart-widget-in-html-5-part-2-pie-chart/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Drag and Drop the Legend and Maintain the Position in Chart</title>
		<link>https://sibeeshpassion.com/drag-and-drop-the-legend-and-maintain-the-position-in-chart/</link>
					<comments>https://sibeeshpassion.com/drag-and-drop-the-legend-and-maintain-the-position-in-chart/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Wed, 29 Apr 2015 20:40:08 +0000</pubDate>
				<category><![CDATA[HighChart]]></category>
		<category><![CDATA[Products]]></category>
		<category><![CDATA[chart]]></category>
		<category><![CDATA[Drag and drop legend in chart.]]></category>
		<category><![CDATA[Drag legend]]></category>
		<category><![CDATA[Draggable Legend]]></category>
		<category><![CDATA[Drop legend]]></category>
		<category><![CDATA[HighChart Legend]]></category>
		<category><![CDATA[HTML5 Chart]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Legend]]></category>
		<guid isPermaLink="false">https://sibeeshpassion.com/?p=1961</guid>

					<description><![CDATA[Today we will learn how to create a drag-able legend and maintain that position in the chart area, so that once we drag and drop the legend, even if we reload the chart again, it will take the legend position from the session storage, where we have set the values when dropping the legend. Cool, right? Background For the past few weeks I have been working in Charts, so a few days ago I got a requirement to make a drag-able legend and maintain the position. As you all know, everyone expects the best from their products, so I began [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Today we will learn how to create a drag-able legend and maintain that position in the chart area, so that once we drag and drop the legend, even if we reload the chart again, it will take the legend position from the session storage, where we have set the values when dropping the legend. Cool, right?</p>
<p><strong>Background</strong></p>
<p>For the past few weeks I have been working in Charts, so a few days ago I got a requirement to make a drag-able legend and maintain the position. As you all know, everyone expects the best from their products, so I began working to satisfy my client by giving them all the feasible options in the chart. Once I was done with that it was good.</p>
<p><strong>Download Source Code</strong></p>
<p><a href="http://sibeeshpassion.com/download/DragAndDropLegend.rar" target="_blank">Drag and Drop the Legend and Maintain the Position</a></p>
<p><strong>Load the required files</strong></p>
<p>To start, we must load some files, you can determine the files below.<br />
[js]<br />
   &lt;script src=&quot;Scripts/jquery-1.11.1.min.js&quot;&gt;&lt;/script&gt;<br />
   &lt;script src=&quot;Scripts/highcharts.js&quot;&gt;&lt;/script&gt;<br />
   &lt;script src=&quot;Scripts/highcharts-more.js&quot;&gt;&lt;/script&gt;<br />
   &lt;script src=&quot;Scripts/draggable-legend.js&quot;&gt;&lt;/script&gt;<br />
[/js]</p>
<p><strong>Creating UI elements</strong></p>
<p>Now we need some UI elements to load the chart and show the drag and drop position. We will show the position values while the user drags and drops the legend, so that it looks more active.<br />
[html]<br />
    &lt;div id=&quot;container&quot; style=&quot;min-width: 310px; height: 400px; margin: 0 auto&quot;&gt;&lt;/div&gt;<br />
    Legend X: &lt;input id=&quot;txtLegendX&quot; type=&quot;number&quot; /&gt; &lt;br /&gt;<br />
    Legend X: &lt;input id=&quot;txtLegendY&quot; type=&quot;number&quot; /&gt;<br />
[/html]</p>
<p><strong>Creating options of chart</strong></p>
<p>The next step we need is to set the options of the chart. Please find the following settings.<br />
[js]<br />
var options = {<br />
                title: {<br />
                    text: &#8216;Worked hours in a week&#8217;<br />
                },<br />
                xAxis: {<br />
                    categories: [&#8216;Developing&#8217;, &#8216;Maitenance&#8217;, &#8216;Marketing&#8217;, &#8216;Business&#8217;, &#8216;Admin&#8217;]<br />
                },<br />
                series: [{<br />
                    type: &#8216;column&#8217;,<br />
                    name: &#8216;Monday&#8217;,<br />
                    data: [3, 2, 1, 3, 4]<br />
                }, {<br />
                    type: &#8216;column&#8217;,<br />
                    name: &#8216;Tuesday&#8217;,<br />
                    data: [2, 3, 5, 7, 6]<br />
                }, {<br />
                    type: &#8216;column&#8217;,<br />
                    name: &#8216;Wednesday&#8217;,<br />
                    data: [4, 3, 3, 9, 0]<br />
                }, {<br />
                    type: &#8216;column&#8217;,<br />
                    name: &#8216;Thursday&#8217;,<br />
                    data: [4, 3, 3, 9, 0]<br />
                }, {<br />
                    type: &#8216;column&#8217;,<br />
                    name: &#8216;Friday&#8217;,<br />
                    data: [4, 3, 3, 9, 0]<br />
                }, {<br />
                    type: &#8216;spline&#8217;,<br />
                    name: &#8216;Thursday&#8217;,<br />
                    data: [3, 2.67, 3, 6.33, 3.33],<br />
                    marker: {<br />
                        lineWidth: 2,<br />
                        lineColor: Highcharts.getOptions().colors[3],<br />
                        fillColor: &#8216;white&#8217;<br />
                    }<br />
                }],<br />
                legend: {<br />
                    enabled: true,<br />
                    layout: &#8216;vertical&#8217;,<br />
                    backgroundColor: &#8216;white&#8217;,<br />
                    align: &#8216;left&#8217;,<br />
                    verticalAlign: &#8216;top&#8217;,<br />
                    y: 50,<br />
                    x: 50,<br />
                    borderWidth: 1,<br />
                    borderRadius: 0,<br />
                    title: {<br />
                        text: &#8216;::Drag Me&#8217;<br />
                    },<br />
                    floating: true,<br />
                    draggable: true,<br />
                    zIndex: 20<br />
                }<br />
            };<br />
[/js]</p>
<p>In the preceding code block we have set the series and other settings including the legend. Please note that we have set the draggable and floating property to true. You can customize all of these properties as you need to.<br />
[js]<br />
floating: true,<br />
draggable: true,<br />
[/js]</p>
<p>Now if you run your application, you will get output as follows.</p>
<div id="attachment_9161" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/04/drag-and-drop-the-legend-and-maintain-the-position-in-chart1-e1439362346617.png"><img decoding="async" aria-describedby="caption-attachment-9161" src="http://sibeeshpassion.com/wp-content/uploads/2015/04/drag-and-drop-the-legend-and-maintain-the-position-in-chart1-e1439362346617.png" alt="Drag and Drop the Legend and Maintain the Position in Chart" width="650" height="148" class="size-full wp-image-9161" srcset="/wp-content/uploads/2015/04/drag-and-drop-the-legend-and-maintain-the-position-in-chart1-e1439362346617.png 650w, /wp-content/uploads/2015/04/drag-and-drop-the-legend-and-maintain-the-position-in-chart1-e1439362346617-300x68.png 300w, /wp-content/uploads/2015/04/drag-and-drop-the-legend-and-maintain-the-position-in-chart1-e1439362346617-400x91.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-9161" class="wp-caption-text">Drag and Drop the Legend and Maintain the Position in Chart</p></div>
<p>So our application is working fine, isn&#8217;t it?</p>
<p><strong>Changes in draggable-legend.js</strong></p>
<p>To continue with the process, we must make some changes in the draggable-legend.js. You can see the changes below. If you download the source code attached, you can see the changes by default.<br />
[js]<br />
addEvent(chart.container, &#8216;mousemove&#8217;, function (e) {  </p>
<p>});<br />
[/js]</p>
<p>I will include some code for our purposes in the preceding function in draggable-legend.js. At the end of the specified function I am including the following code block.<br />
[js]<br />
$(&quot;#txtLegendX&quot;).val(options.x);<br />
$(&quot;#txtLegendY&quot;).val(options.y);<br />
sessionStorage.setItem(&quot;legendx&quot;, options.x);<br />
sessionStorage.setItem(&quot;legendy&quot;, options.y);<br />
[/js]</p>
<p>The purpose of that code block is to set the value to the session storage and the UI element. Now we will run our application and see the output.</p>
<div id="attachment_9171" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/04/drag-and-drop-the-legend-and-maintain-the-position-in-chart2-e1439362411227.png"><img decoding="async" aria-describedby="caption-attachment-9171" src="http://sibeeshpassion.com/wp-content/uploads/2015/04/drag-and-drop-the-legend-and-maintain-the-position-in-chart2-e1439362411227.png" alt="Drag and Drop the Legend and Maintain the Position in Chart" width="650" height="194" class="size-full wp-image-9171" srcset="/wp-content/uploads/2015/04/drag-and-drop-the-legend-and-maintain-the-position-in-chart2-e1439362411227.png 650w, /wp-content/uploads/2015/04/drag-and-drop-the-legend-and-maintain-the-position-in-chart2-e1439362411227-300x90.png 300w, /wp-content/uploads/2015/04/drag-and-drop-the-legend-and-maintain-the-position-in-chart2-e1439362411227-400x119.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-9171" class="wp-caption-text">Drag and Drop the Legend and Maintain the Position in Chart</p></div>
<p>Now if you drag and drop the legend somewhere else, you can see that the values specified in the text boxes has changed.</p>
<div id="attachment_9181" style="width: 644px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/04/drag-and-drop-the-legend-and-maintain-the-position-in-chart3.png"><img decoding="async" aria-describedby="caption-attachment-9181" src="http://sibeeshpassion.com/wp-content/uploads/2015/04/drag-and-drop-the-legend-and-maintain-the-position-in-chart3-1024x280.png" alt="Drag and Drop the Legend and Maintain the Position in Chart" width="634" height="173" class="size-large wp-image-9181" srcset="/wp-content/uploads/2015/04/drag-and-drop-the-legend-and-maintain-the-position-in-chart3.png 1024w, /wp-content/uploads/2015/04/drag-and-drop-the-legend-and-maintain-the-position-in-chart3-300x82.png 300w, /wp-content/uploads/2015/04/drag-and-drop-the-legend-and-maintain-the-position-in-chart3-768x210.png 768w, /wp-content/uploads/2015/04/drag-and-drop-the-legend-and-maintain-the-position-in-chart3-400x109.png 400w" sizes="(max-width: 634px) 100vw, 634px" /></a><p id="caption-attachment-9181" class="wp-caption-text">Drag and Drop the Legend and Maintain the Position in Chart</p></div>
<p>No we will check whether the values are updated to the session storage in the browser console.</p>
<div id="attachment_9191" style="width: 644px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/04/drag-and-drop-the-legend-and-maintain-the-position-in-chart4-e1439362495549.png"><img decoding="async" aria-describedby="caption-attachment-9191" src="http://sibeeshpassion.com/wp-content/uploads/2015/04/drag-and-drop-the-legend-and-maintain-the-position-in-chart4-1024x313.png" alt="Drag and Drop the Legend and Maintain the Position in Chart" width="634" height="194" class="size-large wp-image-9191" /></a><p id="caption-attachment-9191" class="wp-caption-text">Drag and Drop the Legend and Maintain the Position in Chart</p></div>
<p>Cool, it is updated, we are happy.</p>
<p>Now we need to retain this position even if the user reloads the chart, right? Normally what happens is, the chart will be loaded with the initial settings we have set in the option. </p>
<p><strong>Maintain the legend position</strong></p>
<p>To maintain the legend position, we must apply the legend position to the chart, we can take the values from the session storage where we already set the values.<br />
[js]<br />
if (sessionStorage.getItem(&quot;legendx&quot;) != null &amp;&amp; typeof sessionStorage.getItem(&quot;legendx&quot;) != &#8216;undefined&#8217; &amp;&amp; sessionStorage.getItem(&quot;legendy&quot;) != null &amp;&amp; typeof sessionStorage.getItem(&quot;legendy&quot;) != &#8216;undefined&#8217;) {<br />
                options.legend.x = parseInt(sessionStorage.getItem(&quot;legendx&quot;));<br />
                options.legend.y = parseInt(sessionStorage.getItem(&quot;legendy&quot;));<br />
                $(&quot;#txtLegendX&quot;).val(sessionStorage.getItem(&quot;legendx&quot;));<br />
                $(&quot;#txtLegendY&quot;).val(sessionStorage.getItem(&quot;legendy&quot;));<br />
            }<br />
            $(&#8216;#container&#8217;).highcharts(options);<br />
[/js]</p>
<p>We are checking the session storage values and applying values to the options and we provide that options to the chart. Sounds good? So our complete code for this implementation is as follows.</p>
<p><strong>Complete code</strong><br />
[html]<br />
&lt;!DOCTYPE html&gt;<br />
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;<br />
&lt;head&gt;<br />
    &lt;title&gt;Dragable Legend &#8211; sibeeshpassion&lt;/title&gt;<br />
    &lt;script src=&quot;Scripts/jquery-1.11.1.min.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script src=&quot;Scripts/highcharts.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script src=&quot;Scripts/highcharts-more.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script src=&quot;Scripts/draggable-legend.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script&gt;<br />
        $(function () {<br />
            var options = {<br />
                title: {<br />
                    text: &#8216;Worked hours in a week&#8217;<br />
                },<br />
                xAxis: {<br />
                    categories: [&#8216;Developing&#8217;, &#8216;Maitenance&#8217;, &#8216;Marketing&#8217;, &#8216;Business&#8217;, &#8216;Admin&#8217;]<br />
                },<br />
                series: [{<br />
                    type: &#8216;column&#8217;,<br />
                    name: &#8216;Monday&#8217;,<br />
                    data: [3, 2, 1, 3, 4]<br />
                }, {<br />
                    type: &#8216;column&#8217;,<br />
                    name: &#8216;Tuesday&#8217;,<br />
                    data: [2, 3, 5, 7, 6]<br />
                }, {<br />
                    type: &#8216;column&#8217;,<br />
                    name: &#8216;Wednesday&#8217;,<br />
                    data: [4, 3, 3, 9, 0]<br />
                }, {<br />
                    type: &#8216;column&#8217;,<br />
                    name: &#8216;Thursday&#8217;,<br />
                    data: [4, 3, 3, 9, 0]<br />
                }, {<br />
                    type: &#8216;column&#8217;,<br />
                    name: &#8216;Friday&#8217;,<br />
                    data: [4, 3, 3, 9, 0]<br />
                }, {<br />
                    type: &#8216;spline&#8217;,<br />
                    name: &#8216;Thursday&#8217;,<br />
                    data: [3, 2.67, 3, 6.33, 3.33],<br />
                    marker: {<br />
                        lineWidth: 2,<br />
                        lineColor: Highcharts.getOptions().colors[3],<br />
                        fillColor: &#8216;white&#8217;<br />
                    }<br />
                }],<br />
                legend: {<br />
                    enabled: true,<br />
                    layout: &#8216;vertical&#8217;,<br />
                    backgroundColor: &#8216;white&#8217;,<br />
                    align: &#8216;left&#8217;,<br />
                    verticalAlign: &#8216;top&#8217;,<br />
                    y: 50,<br />
                    x: 50,<br />
                    borderWidth: 1,<br />
                    borderRadius: 0,<br />
                    title: {<br />
                        text: &#8216;::Drag Me&#8217;<br />
                    },<br />
                    floating: true,<br />
                    draggable: true,<br />
                    zIndex: 20<br />
                }<br />
            };<br />
            if (sessionStorage.getItem(&quot;legendx&quot;) != null &amp;&amp; typeof sessionStorage.getItem(&quot;legendx&quot;) != &#8216;undefined&#8217; &amp;&amp; sessionStorage.getItem(&quot;legendy&quot;) != null &amp;&amp; typeof sessionStorage.getItem(&quot;legendy&quot;) != &#8216;undefined&#8217;) {<br />
                options.legend.x = parseInt(sessionStorage.getItem(&quot;legendx&quot;));<br />
                options.legend.y = parseInt(sessionStorage.getItem(&quot;legendy&quot;));<br />
                $(&quot;#txtLegendX&quot;).val(sessionStorage.getItem(&quot;legendx&quot;));<br />
                $(&quot;#txtLegendY&quot;).val(sessionStorage.getItem(&quot;legendy&quot;));<br />
            }<br />
            $(&#8216;#container&#8217;).highcharts(options);  </p>
<p>        });<br />
    &lt;/script&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
    Dragable Legend &#8211; sibeeshpassion<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;div id=&quot;container&quot; style=&quot;min-width: 310px; height: 400px; margin: 0 auto&quot;&gt;&lt;/div&gt;<br />
    Legend X: &lt;input id=&quot;txtLegendX&quot; type=&quot;number&quot; /&gt; &lt;br /&gt;<br />
    Legend X: &lt;input id=&quot;txtLegendY&quot; type=&quot;number&quot; /&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;<br />
[/html]</p>
<p><strong>Conclusion</strong></p>
<p>I hope you liked this article. Please provide your valuable suggestions. It matters a lot. Please download the source code to determine more.</p>
<p><strong>Points of interest</strong></p>
<p>Legend, Chart, Drag legend, Drop legend, Drag and drop legend in chart.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sibeeshpassion.com/drag-and-drop-the-legend-and-maintain-the-position-in-chart/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Working With Charts</title>
		<link>https://sibeeshpassion.com/working-with-charts/</link>
					<comments>https://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://sibeeshpassion.com/working-with-charts/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Create a Combo Chart and Make Your Chart Draggable</title>
		<link>https://sibeeshpassion.com/create-a-combo-chart-and-make-your-chart-draggable/</link>
					<comments>https://sibeeshpassion.com/create-a-combo-chart-and-make-your-chart-draggable/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Wed, 29 Apr 2015 20:34:03 +0000</pubDate>
				<category><![CDATA[HighChart]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[chart]]></category>
		<category><![CDATA[Combo Chart]]></category>
		<category><![CDATA[Draggable Chart]]></category>
		<category><![CDATA[HTML5 Chart]]></category>
		<guid isPermaLink="false">https://sibeeshpassion.com/?p=1821</guid>

					<description><![CDATA[Introduction Hi all, this article explains how to create a Combo chart. As you all know, the word combo is short for combination, in this case it is a combination of chart types. Which means we can have multiple chart types in one chart. Background For the past few months I have been working in a dashboard application, so I encountered a situation to work with a Combo chart in my application. As I began working with the Combo chart, when I finished the work I got a new requirement that a Pie chart must be draggable in the chart [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><strong>Introduction</strong><br />
Hi all, this article explains how to create a Combo chart. As you all know, the word combo is short for combination, in this case it is a combination of chart types. Which means we can have multiple chart types in one chart.</p>
<p><strong>Background</strong></p>
<p>For the past few months I have been working in a dashboard application, so I encountered a situation to work with a Combo chart in my application. As I began working with the Combo chart, when I finished the work I got a new requirement that a Pie chart must be draggable in the chart area. So I thought of working on that and share it with you all.</p>
<p><strong>What we need first</strong></p>
<p>Include the necessary JavaScript files and UI elements as follows.</p>
<div>
<div class="dp-highlighter">
<div class="bar"></div>
<ol class="dp-c">
<li class="alt">&lt;script src=<span class="string">&#8220;http://code.highcharts.com/highcharts.js&#8221;</span>&gt;&lt;/script&gt;</li>
<li>&lt;script src=<span class="string">&#8220;http://code.highcharts.com/modules/exporting.js&#8221;</span>&gt;&lt;/script&gt;</li>
<li class="alt">&lt;div id=<span class="string">&#8220;container&#8221;</span> style=<span class="string">&#8220;min-width: 310px; height: 400px; margin: 0 auto&#8221;</span>&gt;&lt;/div&gt;</li>
<li>&lt;div id=<span class="string">&#8220;container2&#8221;</span> style=<span class="string">&#8220;width: 150px; height: 150px; margin: 0 auto; position:absolute; top: 120px; left: 150px;&#8221;</span>&gt;&lt;/div&gt;</li>
</ol>
</div>
</div>
<p><strong>Combo chart configuration</strong></p>
<p>Our next step is to configure the Combo chart. You can determine the configuration here.</p>
<div>
<div class="dp-highlighter">
<div class="bar"></div>
<ol class="dp-c">
<li class="alt">$(function()</li>
<li>{</li>
<li class="alt">    $(<span class="string">&#8216;#container&#8217;</span>).highcharts({</li>
<li>        title: {</li>
<li class="alt">            text: <span class="string">&#8216;Worked hours in a week&#8217;</span></li>
<li>        },</li>
<li class="alt">        xAxis: {</li>
<li>            categories: [<span class="string">&#8216;Apples&#8217;</span>, <span class="string">&#8216;Oranges&#8217;</span>, <span class="string">&#8216;Pears&#8217;</span>, <span class="string">&#8216;Bananas&#8217;</span>, <span class="string">&#8216;Plums&#8217;</span>]</li>
<li class="alt">        },</li>
<li>        series: [{</li>
<li class="alt">            type: <span class="string">&#8216;column&#8217;</span>,</li>
<li>            name: <span class="string">&#8216;Monday&#8217;</span>,</li>
<li class="alt">            data: [3, 2, 1, 3, 4]</li>
<li>        }, {</li>
<li class="alt">            type: <span class="string">&#8216;column&#8217;</span>,</li>
<li>            name: <span class="string">&#8216;Tuesday&#8217;</span>,</li>
<li class="alt">            data: [2, 3, 5, 7, 6]</li>
<li>        }, {</li>
<li class="alt">            type: <span class="string">&#8216;column&#8217;</span>,</li>
<li>            name: <span class="string">&#8216;Wednesday&#8217;</span>,</li>
<li class="alt">            data: [4, 3, 3, 9, 0]</li>
<li>        }, {</li>
<li class="alt">            type: <span class="string">&#8216;column&#8217;</span>,</li>
<li>            name: <span class="string">&#8216;Thursday&#8217;</span>,</li>
<li class="alt">            data: [4, 3, 3, 9, 0]</li>
<li>        }, {</li>
<li class="alt">            type: <span class="string">&#8216;column&#8217;</span>,</li>
<li>            name: <span class="string">&#8216;Friday&#8217;</span>,</li>
<li class="alt">            data: [4, 3, 3, 9, 0]</li>
<li>        }, {</li>
<li class="alt">            type: <span class="string">&#8216;spline&#8217;</span>,</li>
<li>            name: <span class="string">&#8216;Thursday&#8217;</span>,</li>
<li class="alt">            data: [3, 2.67, 3, 6.33, 3.33],</li>
<li>            marker: {</li>
<li class="alt">                lineWidth: 2,</li>
<li>                lineColor: Highcharts.getOptions().colors[3],</li>
<li class="alt">                fillColor: <span class="string">&#8216;white&#8217;</span></li>
<li>            }</li>
<li class="alt">        }]</li>
<li>    });</li>
<li class="alt">    $(<span class="string">&#8216;#container2&#8217;</span>).highcharts({</li>
<li>        chart: {</li>
<li class="alt">            backgroundColor: <span class="string">&#8216;rgba(0,0,0,0)&#8217;</span></li>
<li>        },</li>
<li class="alt">        title: {</li>
<li>            text: <span class="keyword">null</span></li>
<li class="alt">        },</li>
<li>        exporting: {</li>
<li class="alt">            enabled: <span class="keyword">false</span></li>
<li>        },</li>
<li class="alt">        credits: {</li>
<li>            enabled: <span class="keyword">false</span></li>
<li class="alt">        },</li>
<li>        series: [{</li>
<li class="alt">            type: <span class="string">&#8216;pie&#8217;</span>,</li>
<li>            name: <span class="string">&#8216;Total&#8217;</span>,</li>
<li class="alt">            data: [{</li>
<li>                name: <span class="string">&#8216;Monday&#8217;</span>,</li>
<li class="alt">                y: 13,</li>
<li>                color: Highcharts.getOptions().colors[0]</li>
<li class="alt">            }, {</li>
<li>                name: <span class="string">&#8216;Tuesday&#8217;</span>,</li>
<li class="alt">                y: 23,</li>
<li>                color: Highcharts.getOptions().colors[1]</li>
<li class="alt">            }, {</li>
<li>                name: <span class="string">&#8216;Wednesday&#8217;</span>,</li>
<li class="alt">                y: 19,</li>
<li>                color: Highcharts.getOptions().colors[2]</li>
<li class="alt">            }, {</li>
<li>                name: <span class="string">&#8216;Thursday&#8217;</span>,</li>
<li class="alt">                y: 19,</li>
<li>                color: Highcharts.getOptions().colors[2]</li>
<li class="alt">            }, {</li>
<li>                name: <span class="string">&#8216;Friday&#8217;</span>,</li>
<li class="alt">                y: 19,</li>
<li>                color: Highcharts.getOptions().colors[2]</li>
<li class="alt">            }],</li>
<li>            size: 90,</li>
<li class="alt">            showInLegend: <span class="keyword">false</span>,</li>
<li>            dataLabels: {</li>
<li class="alt">                enabled: <span class="keyword">false</span></li>
<li>            }</li>
<li class="alt">        }]</li>
<li>    });</li>
<li class="alt">    $(<span class="string">&#8220;#container2&#8221;</span>).draggable();</li>
<li>});</li>
</ol>
</div>
</div>
<p>Please note that I have given the Pie chart as a separate chart so that we can make it draggable as follows.</p>
<div class="dp-highlighter">
<div class="bar"></div>
<ol class="dp-c">
<li class="alt">$(<span class="string">&#8220;#container2&#8221;</span>).draggable();</li>
</ol>
</div>
<p>You can determine the demo here: <a href="http://jsfiddle.net/sibeeshvenu/oc1mn8ru/4/">http://jsfiddle.net/sibeeshvenu/oc1mn8ru/4/</a></p>
<p><strong>Output</strong></p>
<p>Now if you run this configuration you will get output as follows.</p>
<p><img decoding="async" src="http://www.c-sharpcorner.com/UploadFile/65794e/combo-chart-and-make-chart-as-draggable/Images/comboart1.png" alt="" width="600" height="333" /></p>
<p>Now the interesting fact is, you can drag the pie to where ever you want it.</p>
<p><img decoding="async" src="http://www.c-sharpcorner.com/UploadFile/65794e/combo-chart-and-make-chart-as-draggable/Images/comboart2.png" alt="" width="600" height="325" /></p>
<p><strong>Conclusion</strong></p>
<p>I hope you liked this article. Now please share your thoughts and suggestions. It matters a lot.</p>
<p>Kindest Regards,</p>
<p>Sibeesh Venu<br />
<a href="http://www.c-sharpcorner.com/UploadFile/65794e/combo-chart-and-make-chart-as-draggable/www.sibeeshpassion.com">Sibeesh Passion</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://sibeeshpassion.com/create-a-combo-chart-and-make-your-chart-draggable/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Client Side Chart Widget in HTML 5: Part 8 (Pie Chart With Custom ToolTip)</title>
		<link>https://sibeeshpassion.com/client-side-chart-widget-in-html-5-part-8-pie-chart-with-custom-tooltip/</link>
					<comments>https://sibeeshpassion.com/client-side-chart-widget-in-html-5-part-8-pie-chart-with-custom-tooltip/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Thu, 29 Jan 2015 20:01:56 +0000</pubDate>
				<category><![CDATA[How to]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[chart]]></category>
		<category><![CDATA[HTML5 Chart]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Pie Chart]]></category>
		<category><![CDATA[Tips]]></category>
		<guid isPermaLink="false">https://sibeeshpassion.com/?p=1271</guid>

					<description><![CDATA[In this article we will see how to create a pie chart in HTML5 with custom tool tip. I hope you have read my first two articles in this series that explains the loading of Bar Charts, Pie Charts, Line Charts, Doughnut Charts, Polar Area Charts, Radar Charts and Line Chart with custom tooltip. Please see the following links. Client-Side Chart Widget in HTML 5: Part 1 (Bar Chart) Client-Side Chart Widget in HTML 5: Part 2 (Pie Chart) Client-Side Chart Widget in HTML 5: Part 3 (Line Chart) Client-Side Chart Widget in HTML 5: Part 4 (Doughnut Chart) Client-Side [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>In this article we will see how to create a pie chart in <a href="http://sibeeshpassion.com/category/html5/" target="_blank">HTML5 </a> with custom tool tip. I hope you have read my first two articles in this series that explains the loading of Bar Charts, Pie Charts, Line Charts, Doughnut Charts, Polar Area Charts, Radar Charts and Line Chart with custom tooltip. Please see the following links.</p>
<p><a href="http://www.c-sharpcorner.com/uploadfile/65794e/client-side-chart-widget-in-html-5-part-1-bar-chart/" target="_blank">Client-Side Chart Widget in HTML 5: Part 1 (Bar Chart)</a><br />
<a href="http://www.c-sharpcorner.com/UploadFile/65794e/client-side-chart-widget-in-html-5-part-2-pie-chart/" target="_blank">Client-Side Chart Widget in HTML 5: Part 2 (Pie Chart)</a><br />
<a href="http://www.c-sharpcorner.com/UploadFile/65794e/client-side-chart-widget-in-html5-part-3-line-chart/" target="_blank">Client-Side Chart Widget in HTML 5: Part 3 (Line Chart)</a><br />
<a href="http://www.c-sharpcorner.com/UploadFile/65794e/client-side-chart-widget-in-html5-part-4-doughnut-chart/" target="_blank">Client-Side Chart Widget in HTML 5: Part 4 (Doughnut Chart)</a><br />
<a href="http://www.c-sharpcorner.com/UploadFile/65794e/client-side-chart-widget-in-html5-part-5-polar-area-chart/" target="_blank">Client-Side Chart Widget in HTML 5: Part 5 (Polar Area Chart)</a><br />
<a href="http://www.c-sharpcorner.com/UploadFile/65794e/client-side-chart-widget-in-html5-part-6-radar-chart/" target="_blank">Client-Side Chart Widget in HTML 5: Part 6 (Radar Chart)</a><br />
<a href="http://sibeeshpassion.com/client-side-chart-widget-in-html-5-part-7-line-chart-with-custom-tooltip/" target="_blank">Client Side Chart Widget in HTML 5: Part 7 (Line Chart With Custom ToolTip)</a><br />
Now we will explain a client Pie Chart widget with custom tooltip in HTML5. </p>
<p><strong>Background</strong></p>
<p>Please download the necessary files here.</p>
<p>Using the code</p>
<p><strong>A simple HTML</strong></p>
<p>[html]<br />
&lt;!DOCTYPE html&gt;<br />
   &lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;<br />
      &lt;head&gt;<br />
         &lt;title&gt; Pie Chart widget with custom tooltip Using Chart.js&lt;/title&gt;<br />
      &lt;/head&gt;<br />
      &lt;body&gt;&lt;/body&gt;<br />
   &lt;/html&gt;<br />
[/html]</p>
<p><strong>Included JavaScript file</strong></p>
<p>[html]<br />
&lt;script src=&quot;Chart.js&quot;&gt;&lt;/script&gt;<br />
&lt;script src=&quot;http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js&quot;&gt;&lt;/script&gt;<br />
[/html]   </p>
<p><strong>Include UI Elements</strong></p>
<p>[html]<br />
&lt;div id=&quot;canvas-holder&quot;&gt;<br />
    &lt;canvas id=&quot;chart-area1&quot; width=&quot;50&quot; height=&quot;50&quot; /&gt;<br />
&lt;/div&gt;<br />
&lt;div id=&quot;canvas-holder&quot;&gt;<br />
    &lt;canvas id=&quot;chart-area2&quot; width=&quot;300&quot; height=&quot;300&quot; /&gt;<br />
&lt;/div&gt;<br />
&lt;div id=&quot;chartjs-tooltip&quot;&gt;&lt;/div&gt;<br />
 [/html]</p>
<p><strong>Call the Chart Function</strong></p>
<p>[js]<br />
window.onload = function () {<br />
    var ctx1 = document.getElementById(&quot;chart-area1&quot;).getContext(&quot;2d&quot;);<br />
    window.myPie = new Chart(ctx1).Pie(pieData);  </p>
<p>    var ctx2 = document.getElementById(&quot;chart-area2&quot;).getContext(&quot;2d&quot;);<br />
    window.myPie = new Chart(ctx2).Pie(pieData);<br />
;<br />
[/js]</p>
<p>Here we are loading the chart in the chart-area1 and chart-area2. As you can see in the preceding code, pieData is the data we will load into the chart.</p>
<p>[js]<br />
var pieData = [{<br />
           value: 300,<br />
           color: &quot;#F7464A&quot;,<br />
           highlight: &quot;#FF5A5E&quot;,<br />
           label: &quot;Monday&quot;<br />
       }, {<br />
           value: 50,<br />
           color: &quot;#46BFBD&quot;,<br />
           highlight: &quot;#5AD3D1&quot;,<br />
           label: &quot;Tuesday&quot;<br />
       }, {<br />
           value: 100,<br />
           color: &quot;#FDB45C&quot;,<br />
           highlight: &quot;#FFC870&quot;,<br />
           label: &quot;Wednesday&quot;<br />
       }, {<br />
           value: 40,<br />
           color: &quot;#949FB1&quot;,<br />
           highlight: &quot;#A8B3C5&quot;,<br />
           label: &quot;Thursday&quot;<br />
       }, {<br />
           value: 120,<br />
           color: &quot;#4D5360&quot;,<br />
           highlight: &quot;#616774&quot;,<br />
           label: &quot;Friday&quot;<br />
       }];<br />
[/js]</p>
<p> <strong>Properties</strong></p>
<li>Value</li>
<li>Color</li>
<li>Highlight</li>
<li>Label</li>
<p>Here you can change the properties as you want. </p>
<p>Now add the following style.</p>
<p>[css]<br />
&lt;style&gt;<br />
        #canvas-holder {<br />
            width: 100%;<br />
            margin-top: 50px;<br />
            text-align: center;<br />
        }  </p>
<p>        #chartjs-tooltip {<br />
            opacity: 1;<br />
            position: absolute;<br />
            background: rgba(0, 0, 0, .7);<br />
            color: white;<br />
            padding: 3px;<br />
            border-radius: 3px;<br />
            -webkit-transition: all .1s ease;<br />
            transition: all .1s ease;<br />
            pointer-events: none;<br />
            -webkit-transform: translate(-50%, 0);<br />
            transform: translate(-50%, 0);<br />
        }  </p>
<p>            #chartjs-tooltip.below {<br />
                -webkit-transform: translate(-50%, 0);<br />
                transform: translate(-50%, 0);<br />
            }  </p>
<p>                #chartjs-tooltip.below:before {<br />
                    border: solid;<br />
                    border-color: #111 transparent;<br />
                    border-color: rgba(0, 0, 0, .8) transparent;<br />
                    border-width: 0 8px 8px 8px;<br />
                    bottom: 1em;<br />
                    content: &quot;&quot;;<br />
                    display: block;<br />
                    left: 50%;<br />
                    position: absolute;<br />
                    z-index: 99;<br />
                    -webkit-transform: translate(-50%, -100%);<br />
                    transform: translate(-50%, -100%);<br />
                }  </p>
<p>            #chartjs-tooltip.above {<br />
                -webkit-transform: translate(-50%, -100%);<br />
                transform: translate(-50%, -100%);<br />
            }  </p>
<p>                #chartjs-tooltip.above:before {<br />
                    border: solid;<br />
                    border-color: #111 transparent;<br />
                    border-color: rgba(0, 0, 0, .8) transparent;<br />
                    border-width: 8px 8px 0 8px;<br />
                    bottom: 1em;<br />
                    content: &quot;&quot;;<br />
                    display: block;<br />
                    left: 50%;<br />
                    top: 100%;<br />
                    position: absolute;<br />
                    z-index: 99;<br />
                    -webkit-transform: translate(-50%, 0);<br />
                    transform: translate(-50%, 0);<br />
                }<br />
&lt;/style&gt;<br />
[/css]</p>
<p><strong>Load the tool tip</strong></p>
<p>You can include the tool tip as follows.</p>
<p>[js]<br />
Chart.defaults.global.customTooltips = function (tooltip) {  </p>
<p>            // Tooltip Element<br />
            var tooltipEl = $(&#8216;#chartjs-tooltip&#8217;);  </p>
<p>            // Hide if no tooltip<br />
            if (!tooltip) {<br />
                tooltipEl.css({<br />
                    opacity: 0<br />
                });<br />
                return;<br />
            }  </p>
<p>            // Set caret Position<br />
            tooltipEl.removeClass(&#8216;above below&#8217;);<br />
            tooltipEl.addClass(tooltip.yAlign);  </p>
<p>            // Set Text<br />
            tooltipEl.html(tooltip.text);  </p>
<p>            // Find Y Location on page<br />
            var top;<br />
            if (tooltip.yAlign == &#8216;above&#8217;) {<br />
                top = tooltip.y &#8211; tooltip.caretHeight &#8211; tooltip.caretPadding;<br />
            } else {<br />
                top = tooltip.y + tooltip.caretHeight + tooltip.caretPadding;<br />
            }  </p>
<p>            // Display, position, and set styles for font<br />
            tooltipEl.css({<br />
                opacity: 1,<br />
                left: tooltip.chart.canvas.offsetLeft + tooltip.x + &#8216;px&#8217;,<br />
                top: tooltip.chart.canvas.offsetTop + top + &#8216;px&#8217;,<br />
                fontFamily: tooltip.fontFamily,<br />
                fontSize: tooltip.fontSize,<br />
                fontStyle: tooltip.fontStyle,<br />
            });<br />
        };<br />
[/js]</p>
<p>Please note that you can change your tooltip as needed.</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;Pie Chart with Custom Tooltips&lt;/title&gt;<br />
    &lt;script src=&quot;Chart.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script src=&quot;http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js&quot;&gt;&lt;/script&gt;<br />
    &lt;style&gt;<br />
        #canvas-holder {<br />
            width: 100%;<br />
            margin-top: 50px;<br />
            text-align: center;<br />
        }  </p>
<p>        #chartjs-tooltip {<br />
            opacity: 1;<br />
            position: absolute;<br />
            background: rgba(0, 0, 0, .7);<br />
            color: white;<br />
            padding: 3px;<br />
            border-radius: 3px;<br />
            -webkit-transition: all .1s ease;<br />
            transition: all .1s ease;<br />
            pointer-events: none;<br />
            -webkit-transform: translate(-50%, 0);<br />
            transform: translate(-50%, 0);<br />
        }  </p>
<p>            #chartjs-tooltip.below {<br />
                -webkit-transform: translate(-50%, 0);<br />
                transform: translate(-50%, 0);<br />
            }  </p>
<p>                #chartjs-tooltip.below:before {<br />
                    border: solid;<br />
                    border-color: #111 transparent;<br />
                    border-color: rgba(0, 0, 0, .8) transparent;<br />
                    border-width: 0 8px 8px 8px;<br />
                    bottom: 1em;<br />
                    content: &quot;&quot;;<br />
                    display: block;<br />
                    left: 50%;<br />
                    position: absolute;<br />
                    z-index: 99;<br />
                    -webkit-transform: translate(-50%, -100%);<br />
                    transform: translate(-50%, -100%);<br />
                }  </p>
<p>            #chartjs-tooltip.above {<br />
                -webkit-transform: translate(-50%, -100%);<br />
                transform: translate(-50%, -100%);<br />
            }  </p>
<p>                #chartjs-tooltip.above:before {<br />
                    border: solid;<br />
                    border-color: #111 transparent;<br />
                    border-color: rgba(0, 0, 0, .8) transparent;<br />
                    border-width: 8px 8px 0 8px;<br />
                    bottom: 1em;<br />
                    content: &quot;&quot;;<br />
                    display: block;<br />
                    left: 50%;<br />
                    top: 100%;<br />
                    position: absolute;<br />
                    z-index: 99;<br />
                    -webkit-transform: translate(-50%, 0);<br />
                    transform: translate(-50%, 0);<br />
                }<br />
    &lt;/style&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
    Pie Chart With Custom Tooltip @ &lt;a href=&quot;www.sibeeshpassion.com&quot;&gt;www.sibeeshpassion.com&lt;/a&gt;<br />
    &lt;div id=&quot;canvas-holder&quot;&gt;<br />
        &lt;canvas id=&quot;chart-area1&quot; width=&quot;50&quot; height=&quot;50&quot; /&gt;<br />
    &lt;/div&gt;<br />
    &lt;div id=&quot;canvas-holder&quot;&gt;<br />
        &lt;canvas id=&quot;chart-area2&quot; width=&quot;300&quot; height=&quot;300&quot; /&gt;<br />
    &lt;/div&gt;<br />
    &lt;div id=&quot;chartjs-tooltip&quot;&gt;&lt;/div&gt;  </p>
<p>    &lt;script&gt;<br />
        Chart.defaults.global.customTooltips = function (tooltip) {  </p>
<p>            // Tooltip Element<br />
            var tooltipEl = $(&#8216;#chartjs-tooltip&#8217;);  </p>
<p>            // Hide if no tooltip<br />
            if (!tooltip) {<br />
                tooltipEl.css({<br />
                    opacity: 0<br />
                });<br />
                return;<br />
            }  </p>
<p>            // Set caret Position<br />
            tooltipEl.removeClass(&#8216;above below&#8217;);<br />
            tooltipEl.addClass(tooltip.yAlign);  </p>
<p>            // Set Text<br />
            tooltipEl.html(tooltip.text);  </p>
<p>            // Find Y Location on page<br />
            var top;<br />
            if (tooltip.yAlign == &#8216;above&#8217;) {<br />
                top = tooltip.y &#8211; tooltip.caretHeight &#8211; tooltip.caretPadding;<br />
            } else {<br />
                top = tooltip.y + tooltip.caretHeight + tooltip.caretPadding;<br />
            }  </p>
<p>            // Display, position, and set styles for font<br />
            tooltipEl.css({<br />
                opacity: 1,<br />
                left: tooltip.chart.canvas.offsetLeft + tooltip.x + &#8216;px&#8217;,<br />
                top: tooltip.chart.canvas.offsetTop + top + &#8216;px&#8217;,<br />
                fontFamily: tooltip.fontFamily,<br />
                fontSize: tooltip.fontSize,<br />
                fontStyle: tooltip.fontStyle,<br />
            });<br />
        };  </p>
<p>        var pieData = [{<br />
            value: 300,<br />
            color: &quot;#F7464A&quot;,<br />
            highlight: &quot;#FF5A5E&quot;,<br />
            label: &quot;Monday&quot;<br />
        }, {<br />
            value: 50,<br />
            color: &quot;#46BFBD&quot;,<br />
            highlight: &quot;#5AD3D1&quot;,<br />
            label: &quot;Tuesday&quot;<br />
        }, {<br />
            value: 100,<br />
            color: &quot;#FDB45C&quot;,<br />
            highlight: &quot;#FFC870&quot;,<br />
            label: &quot;Wednesday&quot;<br />
        }, {<br />
            value: 40,<br />
            color: &quot;#949FB1&quot;,<br />
            highlight: &quot;#A8B3C5&quot;,<br />
            label: &quot;Thursday&quot;<br />
        }, {<br />
            value: 120,<br />
            color: &quot;#4D5360&quot;,<br />
            highlight: &quot;#616774&quot;,<br />
            label: &quot;Friday&quot;<br />
        }];  </p>
<p>        window.onload = function () {<br />
            var ctx1 = document.getElementById(&quot;chart-area1&quot;).getContext(&quot;2d&quot;);<br />
            window.myPie = new Chart(ctx1).Pie(pieData);  </p>
<p>            var ctx2 = document.getElementById(&quot;chart-area2&quot;).getContext(&quot;2d&quot;);<br />
            window.myPie = new Chart(ctx2).Pie(pieData);<br />
        };<br />
    &lt;/script&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;<br />
[/html]</p>
<p><strong>Output</strong></p>
<div id="attachment_11050" style="width: 274px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/01/Pie-Chart-In-HTML5.jpg"><img decoding="async" aria-describedby="caption-attachment-11050" src="http://sibeeshpassion.com/wp-content/uploads/2015/01/Pie-Chart-In-HTML5.jpg" alt="Pie Chart In HTML5" width="264" height="345" class="size-full wp-image-11050" srcset="/wp-content/uploads/2015/01/Pie-Chart-In-HTML5.jpg 264w, /wp-content/uploads/2015/01/Pie-Chart-In-HTML5-230x300.jpg 230w" sizes="(max-width: 264px) 100vw, 264px" /></a><p id="caption-attachment-11050" class="wp-caption-text">Pie Chart In HTML5</p></div>
<p><strong>Conclusion</strong></p>
<p>Did I miss anything that you may think which is needed? 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 can.</p>
<p>Kindest Regards<br />
Sibeesh Venu</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sibeeshpassion.com/client-side-chart-widget-in-html-5-part-8-pie-chart-with-custom-tooltip/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Client Side Chart Widget in HTML 5: Part 7 (Line Chart With Custom ToolTip)</title>
		<link>https://sibeeshpassion.com/client-side-chart-widget-in-html-5-part-7-line-chart-with-custom-tooltip/</link>
					<comments>https://sibeeshpassion.com/client-side-chart-widget-in-html-5-part-7-line-chart-with-custom-tooltip/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Thu, 29 Jan 2015 19:59:18 +0000</pubDate>
				<category><![CDATA[How to]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[chart]]></category>
		<category><![CDATA[HTML5 Chart]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Line Chart]]></category>
		<category><![CDATA[Tips]]></category>
		<guid isPermaLink="false">https://sibeeshpassion.com/?p=1211</guid>

					<description><![CDATA[In this article we will see how to create a line chart in HTML5 with custom tool tip. We all works in charts right?. Charts are the most effective form of data representation. Here we will see a client side line chart. I hope you have read my first two articles in this series that explains the loading of Bar Charts, Pie Charts, Line Charts, Doughnut Charts, Polar Area Charts and Radar Charts. Please see the following links. Client-Side Chart Widget in HTML 5: Part 1 (Bar Chart) Client-Side Chart Widget in HTML 5: Part 2 (Pie Chart) Client-Side Chart [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>In this article we will see how to create a line chart in <a href="http://sibeeshpassion.com/category/html5/" target="_blank">HTML5 </a> with custom tool tip. We all works in charts right?. Charts are the most effective form of data representation. Here we will see a client side line chart. I hope you have read my first two articles in this series that explains the loading of Bar Charts, Pie Charts, Line Charts, Doughnut Charts, Polar Area Charts and Radar Charts. Please see the following links.</p>
<p><a href="http://www.c-sharpcorner.com/uploadfile/65794e/client-side-chart-widget-in-html-5-part-1-bar-chart/" target="_blank">Client-Side Chart Widget in HTML 5: Part 1 (Bar Chart)</a><br />
<a href="http://www.c-sharpcorner.com/UploadFile/65794e/client-side-chart-widget-in-html-5-part-2-pie-chart/" target="_blank">Client-Side Chart Widget in HTML 5: Part 2 (Pie Chart)</a><br />
<a href="http://www.c-sharpcorner.com/UploadFile/65794e/client-side-chart-widget-in-html5-part-3-line-chart/" target="_blank">Client-Side Chart Widget in HTML 5: Part 3 (Line Chart)</a><br />
<a href="http://www.c-sharpcorner.com/UploadFile/65794e/client-side-chart-widget-in-html5-part-4-doughnut-chart/" target="_blank">Client-Side Chart Widget in HTML 5: Part 4 (Doughnut Chart)</a><br />
<a href="http://www.c-sharpcorner.com/UploadFile/65794e/client-side-chart-widget-in-html5-part-5-polar-area-chart/" target="_blank">Client-Side Chart Widget in HTML 5: Part 5 (Polar Area Chart)</a><br />
<a href="http://www.c-sharpcorner.com/UploadFile/65794e/client-side-chart-widget-in-html5-part-6-radar-chart/" target="_blank">Client-Side Chart Widget in HTML 5: Part 6 (Radar Chart)</a></p>
<p>Now we will explain a client Line Chart widget with custom tooltip in HTML5. </p>
<p><strong>Background</strong></p>
<p>Please download the necessary files <a href="http://www.chartjs.org/" target="_blank">here</a>.</p>
<p><strong>Using the code</strong></p>
<p><strong>A simple HTML</strong><br />
[html]<br />
&lt;!DOCTYPE html&gt;<br />
   &lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;<br />
      &lt;head&gt;<br />
         &lt;title&gt; Line Chart widget with custom tooltip Using Chart.js&lt;/title&gt;<br />
      &lt;/head&gt;<br />
      &lt;body&gt;&lt;/body&gt;<br />
   &lt;/html&gt;<br />
[/html]</p>
<p><strong>Included JavaScript file</strong></p>
<p>[html]<br />
&lt;script src=&quot;Chart.js&quot;&gt;&lt;/script&gt;<br />
&lt;script src=&quot;http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js&quot;&gt;&lt;/script&gt;<br />
[/html]</p>
<p><strong>Call the Chart Function</strong><br />
[js]<br />
window.onload = function () {<br />
   var ctx1 = document.getElementById(&quot;myChart&quot;).getContext(&quot;2d&quot;);<br />
   window.myLine = new Chart(ctx1).Line(lineChartData, {<br />
      showScale: false,<br />
      pointDot: true,<br />
      responsive: true<br />
   });<br />
};<br />
[/js]</p>
<p>Here we are loading the chart in the myChart. As you can see in the preceding code, lineChartData is the data we will load into the chart.<br />
[js]<br />
var lineChartData = {<br />
    labels: [&quot;Monday&quot;, &quot;Tuesday&quot;, &quot;Wednesday&quot;, &quot;Thursday&quot;, &quot;Friday&quot;, &quot;Saturday&quot;, &quot;Sunday&quot;],<br />
    datasets: [{<br />
        label: &quot;My First dataset&quot;,<br />
        fillColor: &quot;rgba(220,220,220,0.2)&quot;,<br />
        strokeColor: &quot;rgba(220,220,220,1)&quot;,<br />
        pointColor: &quot;rgba(220,220,220,1)&quot;,<br />
        pointStrokeColor: &quot;#fff&quot;,<br />
        pointHighlightFill: &quot;#fff&quot;,<br />
        pointHighlightStroke: &quot;rgba(220,220,220,1)&quot;,<br />
        data: [randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor()]<br />
    }, {<br />
        label: &quot;My Second dataset&quot;,<br />
        fillColor: &quot;rgba(151,187,205,0.2)&quot;,<br />
        strokeColor: &quot;rgba(151,187,205,1)&quot;,<br />
        pointColor: &quot;rgba(151,187,205,1)&quot;,<br />
        pointStrokeColor: &quot;#fff&quot;,<br />
        pointHighlightFill: &quot;#fff&quot;,<br />
        pointHighlightStroke: &quot;rgba(151,187,205,1)&quot;,<br />
        data: [randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor()]<br />
    }]<br />
       };<br />
[/js]</p>
<p><strong>Properties  </strong></p>
<li>Labels</li>
<li>Datasets</li>
<li>label ( label for your dataset)</li>
<li>fillColor</li>
<li>strokeColor</li>
<li>pointColor</li>
<li>pointStrokeColor</li>
<li>pointHighlightFill</li>
<li>pointHighlightStroke</li>
<li>data</li>
<p>Here you can change the properties as you want. Now add the following style for our tooltip:<br />
[css]<br />
&lt;style&gt;<br />
    #chartjs-tooltip {<br />
        opacity: 1;<br />
        position: absolute;<br />
        background: rgba(0, 0, 0, .7);<br />
        color: white;<br />
        padding: 3px;<br />
        border-radius: 3px;<br />
        -webkit-transition: all .1s ease;<br />
        transition: all .1s ease;<br />
        pointer-events: none;<br />
        -webkit-transform: translate(-50%, 0);<br />
        transform: translate(-50%, 0);<br />
    }  </p>
<p>    .chartjs-tooltip-key {<br />
        display: inline-block;<br />
        width: 10px;<br />
        height: 10px;<br />
    }<br />
&lt;/style&gt;<br />
[/css]</p>
<p><strong>Load the tooltip</strong></p>
<p>You can include the tooltip as follows.<br />
[js]<br />
Chart.defaults.global.pointHitDetectionRadius = 1;<br />
Chart.defaults.global.customTooltips = function (tooltip) {<br />
    var tooltipEl = $(&#8216;#chartjs-tooltip&#8217;);  </p>
<p>    if (!tooltip) {<br />
        tooltipEl.css({<br />
            opacity: 0<br />
        });<br />
        return;<br />
    }  </p>
<p>    tooltipEl.removeClass(&#8216;above below&#8217;);<br />
    tooltipEl.addClass(tooltip.yAlign);  </p>
<p>    var innerHtml = &#8221;;<br />
    for (var i = tooltip.labels.length &#8211; 1; i &gt;= 0; i&#8211;) {<br />
        innerHtml += [<br />
            &#8216;&lt;div class=&quot;chartjs-tooltip-section&quot;&gt;&#8217;,<br />
            &#8216;   &lt;span class=&quot;chartjs-tooltip-key&quot; style=&quot;background-color:&#8217; + tooltip.legendColors[i].fill + &#8216;&quot;&gt;&lt;/span&gt;&#8217;,<br />
            &#8216;   &lt;span class=&quot;chartjs-tooltip-value&quot;&gt;&#8217; + &#8216;My Custom Tooltip : &#8216;+ tooltip.labels[i] + &#8216;&lt;/span&gt;&#8217;,<br />
            &#8216;&lt;/div&gt;&#8217;<br />
        ].join(&#8221;);<br />
    }<br />
    tooltipEl.html(innerHtml);  </p>
<p>    tooltipEl.css({<br />
        opacity: 1,<br />
        left: tooltip.chart.canvas.offsetLeft + tooltip.x + &#8216;px&#8217;,<br />
        top: tooltip.chart.canvas.offsetTop + tooltip.y + &#8216;px&#8217;,<br />
        fontFamily: tooltip.fontFamily,<br />
        fontSize: tooltip.fontSize,<br />
        fontStyle: tooltip.fontStyle,<br />
    });<br />
};<br />
[/js]</p>
<p>Please note that you can change your tooltip as needed.</p>
<p><strong>Complete Code</strong><br />
[html]<br />
&lt;!doctype html&gt;<br />
&lt;html&gt;<br />
&lt;head&gt;<br />
    &lt;title&gt;Line Chart with Custom Tooltips&lt;/title&gt;<br />
    &lt;script src=&quot;Chart.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script src=&quot;http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js&quot;&gt;&lt;/script&gt;<br />
    &lt;style&gt;<br />
        #canvas-holder1 {<br />
            width: 300px;<br />
            margin: 20px auto;<br />
        }  </p>
<p>        #chartjs-tooltip {<br />
            opacity: 1;<br />
            position: absolute;<br />
            background: rgba(0, 0, 0, .7);<br />
            color: white;<br />
            padding: 3px;<br />
            border-radius: 3px;<br />
            -webkit-transition: all .1s ease;<br />
            transition: all .1s ease;<br />
            pointer-events: none;<br />
            -webkit-transform: translate(-50%, 0);<br />
            transform: translate(-50%, 0);<br />
        }  </p>
<p>        .chartjs-tooltip-key {<br />
            display: inline-block;<br />
            width: 10px;<br />
            height: 10px;<br />
        }<br />
    &lt;/style&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
    &lt;div&gt;<br />
        Line Chart With Custom Tooltip @ &lt;a href=&quot;www.sibeeshpassion.com&quot;&gt;www.sibeeshpassion.com&lt;/a&gt;<br />
        &lt;canvas id=&quot;myChart&quot;&gt;&lt;/canvas&gt;<br />
    &lt;/div&gt;<br />
    &lt;div id=&quot;chartjs-tooltip&quot;&gt;&lt;/div&gt;  </p>
<p>    &lt;script&gt;  </p>
<p>        Chart.defaults.global.pointHitDetectionRadius = 1;<br />
        Chart.defaults.global.customTooltips = function (tooltip) {  </p>
<p>            var tooltipEl = $(&#8216;#chartjs-tooltip&#8217;);  </p>
<p>            if (!tooltip) {<br />
                tooltipEl.css({<br />
                    opacity: 0<br />
                });<br />
                return;<br />
            }  </p>
<p>            tooltipEl.removeClass(&#8216;above below&#8217;);<br />
            tooltipEl.addClass(tooltip.yAlign);  </p>
<p>            var innerHtml = &#8221;;<br />
            for (var i = tooltip.labels.length &#8211; 1; i &gt;= 0; i&#8211;) {<br />
                innerHtml += [<br />
                    &#8216;&lt;div class=&quot;chartjs-tooltip-section&quot;&gt;&#8217;,<br />
                    &#8216;   &lt;span class=&quot;chartjs-tooltip-key&quot; style=&quot;background-color:&#8217; + tooltip.legendColors[i].fill + &#8216;&quot;&gt;&lt;/span&gt;&#8217;,<br />
                    &#8216;   &lt;span class=&quot;chartjs-tooltip-value&quot;&gt;&#8217; + &#8216;My Custom Tooltip : &#8216;+ tooltip.labels[i] + &#8216;&lt;/span&gt;&#8217;,<br />
                    &#8216;&lt;/div&gt;&#8217;<br />
                ].join(&#8221;);<br />
            }<br />
            tooltipEl.html(innerHtml);  </p>
<p>            tooltipEl.css({<br />
                opacity: 1,<br />
                left: tooltip.chart.canvas.offsetLeft + tooltip.x + &#8216;px&#8217;,<br />
                top: tooltip.chart.canvas.offsetTop + tooltip.y + &#8216;px&#8217;,<br />
                fontFamily: tooltip.fontFamily,<br />
                fontSize: tooltip.fontSize,<br />
                fontStyle: tooltip.fontStyle,<br />
            });<br />
        };<br />
        var randomScalingFactor = function () {<br />
            return Math.round(Math.random() * 100);<br />
        };<br />
        var lineChartData = {<br />
            labels: [&quot;Monday&quot;, &quot;Tuesday&quot;, &quot;Wednesday&quot;, &quot;Thursday&quot;, &quot;Friday&quot;, &quot;Saturday&quot;, &quot;Sunday&quot;],<br />
            datasets: [{<br />
                label: &quot;My First dataset&quot;,<br />
                fillColor: &quot;rgba(220,220,220,0.2)&quot;,<br />
                strokeColor: &quot;rgba(220,220,220,1)&quot;,<br />
                pointColor: &quot;rgba(220,220,220,1)&quot;,<br />
                pointStrokeColor: &quot;#fff&quot;,<br />
                pointHighlightFill: &quot;#fff&quot;,<br />
                pointHighlightStroke: &quot;rgba(220,220,220,1)&quot;,<br />
                data: [randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor()]<br />
            }, {<br />
                label: &quot;My Second dataset&quot;,<br />
                fillColor: &quot;rgba(151,187,205,0.2)&quot;,<br />
                strokeColor: &quot;rgba(151,187,205,1)&quot;,<br />
                pointColor: &quot;rgba(151,187,205,1)&quot;,<br />
                pointStrokeColor: &quot;#fff&quot;,<br />
                pointHighlightFill: &quot;#fff&quot;,<br />
                pointHighlightStroke: &quot;rgba(151,187,205,1)&quot;,<br />
                data: [randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor()]<br />
            }]<br />
        };  </p>
<p>        window.onload = function () {<br />
            var ctx1 = document.getElementById(&quot;myChart&quot;).getContext(&quot;2d&quot;);<br />
            window.myLine = new Chart(ctx1).Line(lineChartData, {<br />
                showScale: false,<br />
                pointDot: true,<br />
                responsive: true<br />
            });<br />
        };<br />
    &lt;/script&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;<br />
[/html]</p>
<p><strong>Output</strong></p>
<div id="attachment_11048" style="width: 634px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/01/Line-Chart.jpg"><img decoding="async" aria-describedby="caption-attachment-11048" src="http://sibeeshpassion.com/wp-content/uploads/2015/01/Line-Chart.jpg" alt="Line Chart With Custom Tool Tip" width="624" height="323" class="size-full wp-image-11048" srcset="/wp-content/uploads/2015/01/Line-Chart.jpg 624w, /wp-content/uploads/2015/01/Line-Chart-300x155.jpg 300w, /wp-content/uploads/2015/01/Line-Chart-400x207.jpg 400w" sizes="(max-width: 624px) 100vw, 624px" /></a><p id="caption-attachment-11048" class="wp-caption-text">Line Chart With Custom Tool Tip</p></div>
<p><strong>Conclusion</strong></p>
<p>Did I miss anything that you may think which is needed? 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 can.</p>
<p>Kindest Regards<br />
Sibeesh Venu</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sibeeshpassion.com/client-side-chart-widget-in-html-5-part-7-line-chart-with-custom-tooltip/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Client Side Chart Widget in HTML5: Part 6 (Radar Chart)</title>
		<link>https://sibeeshpassion.com/client-side-chart-widget-in-html5-part-6-radar-chart/</link>
					<comments>https://sibeeshpassion.com/client-side-chart-widget-in-html5-part-6-radar-chart/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Thu, 29 Jan 2015 19:54:49 +0000</pubDate>
				<category><![CDATA[HTML5]]></category>
		<category><![CDATA[chart]]></category>
		<category><![CDATA[HTML5 Chart]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Radar Chart]]></category>
		<guid isPermaLink="false">https://sibeeshpassion.com/?p=1121</guid>

					<description><![CDATA[Introduction I hope you have read my first two articles in this series that explains the loading of Bar Charts, Pie Charts, Line Charts, Doughnut Charts and Polar Area Charts. Please see the following links. Client-Side Chart Widget in HTML 5: Part 1 (Bar Chart) Client-Side Chart Widget in HTML 5: Part 2 (Pie Chart) Client-Side Chart Widget in HTML 5: Part 3 (Line Chart) Client-Side Chart Widget in HTML5: Part 4 (Doughnut Chart) Client-Side Chart Widget in HTML5: Part 5 (Polar Area Chart) Now we will explain a client Radar Chart widget in HTML5. Background Please download the necessary [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><strong>Introduction<br />
</strong><br />
I hope you have read my first two articles in this series that explains the loading of Bar Charts, Pie Charts, Line Charts, Doughnut Charts and Polar Area Charts. Please see the following links.</p>
<ul>
<li><a href="http://www.c-sharpcorner.com/uploadfile/65794e/client-side-chart-widget-in-html-5-part-1-bar-chart/">Client-Side Chart Widget in HTML 5: Part 1 (Bar Chart)</a></li>
<li><a href="http://www.c-sharpcorner.com/UploadFile/65794e/client-side-chart-widget-in-html-5-part-2-pie-chart/">Client-Side Chart Widget in HTML 5: Part 2 (Pie Chart)</a></li>
<li><a href="http://www.c-sharpcorner.com/UploadFile/65794e/client-side-chart-widget-in-html5-part-3-line-chart/">Client-Side Chart Widget in HTML 5: Part 3 (Line Chart)</a></li>
<li><a href="http://www.c-sharpcorner.com/UploadFile/65794e/client-side-chart-widget-in-html5-part-4-doughnut-chart/">Client-Side Chart Widget in HTML5: Part 4 (Doughnut Chart)</a></li>
<li><a href="http://www.c-sharpcorner.com/UploadFile/65794e/client-side-chart-widget-in-html5-part-5-polar-area-chart/">Client-Side Chart Widget in HTML5: Part 5 (Polar Area Chart)</a></li>
</ul>
<p><span style="font-family: calibri;">Now we will explain a client Radar Chart widget in HTML5. </span></p>
<p><strong>Background<br />
</strong><br />
<span style="font-family: calibri;">Please download the necessary files here </span><a href="http://www.chartjs.org/">http://www.chartjs.org/</a><span style="font-family: calibri;">.</span></p>
<p><strong>Using the code</p>
<p>A simple HTML<br />
</strong></p>
<div class="dp-highlighter">
<div class="bar"></div>
<ol class="dp-xml">
<li class="alt">&lt;!DOCTYPE html<span class="tag">&gt;</span></li>
<li><span class="tag">&lt;</span><span class="tag-name">html</span> <span class="attribute">xmlns</span>=<span class="attribute-value">&#8220;http://www.w3.org/1999/xhtml&#8221;</span><span class="tag">&gt;</span></li>
<li class="alt"><span class="tag">&lt;</span><span class="tag-name">head</span><span class="tag">&gt;</span></li>
<li>    <span class="tag">&lt;</span><span class="tag-name">title</span><span class="tag">&gt;</span> Radar Chart Using Chart.js<span class="tag">&lt;/</span><span class="tag-name">title</span><span class="tag">&gt;</span></li>
<li class="alt"><span class="tag">&lt;/</span><span class="tag-name">head</span><span class="tag">&gt;</span></li>
<li><span class="tag">&lt;</span><span class="tag-name">body</span><span class="tag">&gt;</span><span class="tag">&lt;/</span><span class="tag-name">body</span><span class="tag">&gt;</span></li>
<li class="alt"><span class="tag">&lt;/</span><span class="tag-name">html</span><span class="tag">&gt;</span></li>
</ol>
</div>
<p><strong>Included JavaScript file</strong></p>
<div class="dp-highlighter">
<div class="bar"></div>
<ol class="dp-xml">
<li class="alt"><span class="tag">&lt;</span><span class="tag-name">script</span> <span class="attribute">src</span>=<span class="attribute-value">&#8220;Chart.js&#8221;</span><span class="tag">&gt;</span><span class="tag">&lt;/</span><span class="tag-name">script</span><span class="tag">&gt;</span></li>
</ol>
</div>
<p><strong>Call the Chart Function</strong></p>
<div class="dp-highlighter">
<div class="bar"></div>
<ol class="dp-xml">
<li class="alt"><span class="attribute">window.onload</span> = <span class="attribute-value">function</span> () {</li>
<li>    var <span class="attribute">canvasObject</span> = <span class="attribute-value">document</span>.getElementById(&#8220;myChart&#8221;).getContext(&#8220;2d&#8221;);</li>
<li class="alt">    <span class="attribute">window.myRadar</span> = <span class="attribute-value">new</span> Chart(canvasObject).Radar(radarChartData, {</li>
<li>        responsive: true</li>
<li class="alt">    });</li>
<li>}</li>
</ol>
</div>
<p><span style="font-family: calibri;">Here we are loading the chart in the myChart. </span></p>
<p><span style="font-family: calibri;">As you can see in the preceding code, radarChartData is the data we will load into the chart.</span></p>
<div class="dp-highlighter">
<div class="bar"></div>
<ol class="dp-xml">
<li class="alt">var <span class="attribute">radarChartData</span> = {</li>
<li>        labels: [&#8220;Monday&#8221;, &#8220;Tuesday&#8221;, &#8220;Wednesday&#8221;, &#8220;Thursday&#8221;, &#8220;Friday&#8221;, &#8220;Saturday&#8221;, &#8220;Sunday&#8221;],</li>
<li class="alt">        datasets: [</li>
<li>            {</li>
<li class="alt">                label: &#8220;Dataset 1&#8221;,</li>
<li>                fillColor: &#8220;#66FFFF&#8221;,</li>
<li class="alt">                strokeColor: &#8220;#800000&#8221;,</li>
<li>                pointColor: &#8220;rgba(220,220,220,1)&#8221;,</li>
<li class="alt">                pointStrokeColor: &#8220;#000&#8221;,</li>
<li>                pointHighlightFill: &#8220;#FF1919&#8221;,</li>
<li class="alt">                pointHighlightStroke: &#8220;rgba(220,220,220,1)&#8221;,</li>
<li>                data: [65, 59, 90, 81, 56, 55, 40]</li>
<li class="alt">            },</li>
<li>            {</li>
<li class="alt">                label: &#8220;Dataset 2&#8221;,</li>
<li>                fillColor: &#8220;#0033CC&#8221;,</li>
<li class="alt">                strokeColor: &#8220;#800000&#8221;,</li>
<li>                pointColor: &#8220;rgba(151,187,205,1)&#8221;,</li>
<li class="alt">                pointStrokeColor: &#8220;#000&#8221;,</li>
<li>                pointHighlightFill: &#8220;#FF1919&#8221;,</li>
<li class="alt">                pointHighlightStroke: &#8220;rgba(151,187,205,1)&#8221;,</li>
<li>                data: [28, 48, 40, 19, 96, 27, 100]</li>
<li class="alt">            }</li>
<li>        ]</li>
<li class="alt">    };</li>
</ol>
</div>
<p><strong>Properties</strong></p>
<ul>
<li>Labels</li>
<li>Datasets
<ol>
<li>label ( label for your dataset)</li>
<li>fillColor</li>
<li>strokeColor</li>
<li>pointColor</li>
<li>pointStrokeColor</li>
<li>pointHighlightFill</li>
<li>pointHighlightStroke</li>
<li>data</li>
</ol>
</li>
</ul>
<p>Here you can change the properties as you want.</p>
<p><strong>Complete HTML<br />
</strong></p>
<div class="dp-highlighter">
<div class="bar"></div>
<ol class="dp-xml">
<li class="alt">&lt;!DOCTYPE html<span class="tag">&gt;</span></li>
<li><span class="tag">&lt;</span><span class="tag-name">html</span> <span class="attribute">xmlns</span>=<span class="attribute-value">&#8220;http://www.w3.org/1999/xhtml&#8221;</span><span class="tag">&gt;</span></li>
<li class="alt"><span class="tag">&lt;</span><span class="tag-name">head</span><span class="tag">&gt;</span></li>
<li>    <span class="tag">&lt;</span><span class="tag-name">title</span><span class="tag">&gt;</span>Radar Chart Using Chart.js<span class="tag">&lt;/</span><span class="tag-name">title</span><span class="tag">&gt;</span></li>
<li class="alt">    <span class="tag">&lt;</span><span class="tag-name">script</span> <span class="attribute">src</span>=<span class="attribute-value">&#8220;Chart.js&#8221;</span><span class="tag">&gt;</span><span class="tag">&lt;/</span><span class="tag-name">script</span><span class="tag">&gt;</span></li>
<li>    <span class="tag">&lt;</span><span class="tag-name">script</span><span class="tag">&gt;</span></li>
<li class="alt">        var <span class="attribute">radarChartData</span> = {</li>
<li>            labels: [&#8220;Monday&#8221;, &#8220;Tuesday&#8221;, &#8220;Wednesday&#8221;, &#8220;Thursday&#8221;, &#8220;Friday&#8221;, &#8220;Saturday&#8221;, &#8220;Sunday&#8221;],</li>
<li class="alt">            datasets: [</li>
<li>                {</li>
<li class="alt">                    label: &#8220;Dataset 1&#8221;,</li>
<li>                    fillColor: &#8220;#66FFFF&#8221;,</li>
<li class="alt">                    strokeColor: &#8220;#800000&#8221;,</li>
<li>                    pointColor: &#8220;rgba(220,220,220,1)&#8221;,</li>
<li class="alt">                    pointStrokeColor: &#8220;#000&#8221;,</li>
<li>                    pointHighlightFill: &#8220;#FF1919&#8221;,</li>
<li class="alt">                    pointHighlightStroke: &#8220;rgba(220,220,220,1)&#8221;,</li>
<li>                    data: [65, 59, 90, 81, 56, 55, 40]</li>
<li class="alt">                },</li>
<li>                {</li>
<li class="alt">                    label: &#8220;Dataset 2&#8221;,</li>
<li>                    fillColor: &#8220;#0033CC&#8221;,</li>
<li class="alt">                    strokeColor: &#8220;#800000&#8221;,</li>
<li>                    pointColor: &#8220;rgba(151,187,205,1)&#8221;,</li>
<li class="alt">                    pointStrokeColor: &#8220;#000&#8221;,</li>
<li>                    pointHighlightFill: &#8220;#FF1919&#8221;,</li>
<li class="alt">                    pointHighlightStroke: &#8220;rgba(151,187,205,1)&#8221;,</li>
<li>                    data: [28, 48, 40, 19, 96, 27, 100]</li>
<li class="alt">                }</li>
<li>            ]</li>
<li class="alt">        };</li>
<li></li>
<li class="alt">        <span class="attribute">window.onload</span> = <span class="attribute-value">function</span> () {</li>
<li>            var <span class="attribute">canvasObject</span> = <span class="attribute-value">document</span>.getElementById(&#8220;myChart&#8221;).getContext(&#8220;2d&#8221;);</li>
<li class="alt">            <span class="attribute">window.myRadar</span> = <span class="attribute-value">new</span> Chart(canvasObject).Radar(radarChartData, {</li>
<li>                responsive: true</li>
<li class="alt">            });</li>
<li>        }</li>
<li class="alt"></li>
<li>    <span class="tag">&lt;/</span><span class="tag-name">script</span><span class="tag">&gt;</span></li>
<li class="alt"><span class="tag">&lt;/</span><span class="tag-name">head</span><span class="tag">&gt;</span></li>
<li><span class="tag">&lt;</span><span class="tag-name">body</span><span class="tag">&gt;</span></li>
<li class="alt">    <span class="tag">&lt;</span><span class="tag-name">div</span><span class="tag">&gt;</span></li>
<li>        Radar Area Chart @ <span class="tag">&lt;</span><span class="tag-name">a</span> <span class="attribute">href</span>=<span class="attribute-value">&#8220;www.sibeeshpassion.com&#8221;</span><span class="tag">&gt;</span>www.sibeeshpassion.com<span class="tag">&lt;/</span><span class="tag-name">a</span><span class="tag">&gt;</span></li>
<li class="alt">        <span class="tag">&lt;</span><span class="tag-name">canvas</span> <span class="attribute">id</span>=<span class="attribute-value">&#8220;myChart&#8221;</span><span class="tag">&gt;</span><span class="tag">&lt;/</span><span class="tag-name">canvas</span><span class="tag">&gt;</span></li>
<li>    <span class="tag">&lt;/</span><span class="tag-name">div</span><span class="tag">&gt;</span></li>
<li class="alt"><span class="tag">&lt;/</span><span class="tag-name">body</span><span class="tag">&gt;</span></li>
<li><span class="tag">&lt;/</span><span class="tag-name">html</span><span class="tag">&gt;</span></li>
</ol>
</div>
<p><strong>Conclusion</p>
<p></strong><span style="font-family: calibri;">I hope you can now create your own chart.</span></p>
<p><strong>Output</p>
<p><img decoding="async" src="http://www.c-sharpcorner.com/UploadFile/65794e/client-side-chart-widget-in-html5-part-6-radar-chart/Images/Radar%20Chart.jpg" alt="Radar Chart" /></strong></p>
]]></content:encoded>
					
					<wfw:commentRss>https://sibeeshpassion.com/client-side-chart-widget-in-html5-part-6-radar-chart/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
