Welcome Guest Search | Active Topics |

How to remove a chart?
lung12
#1 Posted : Thursday, August 16, 2012 8:30:57 PM(UTC)
Rank: Member

Groups: Registered
Joined: 8/16/2012(UTC)
Posts: 15

Thanks: 0 times
Was thanked: 0 time(s) in 0 post(s)
Does anyone know how to remove a chart (e.g. line chart) and then draw a different chart (bar chart) in the same location?

Regards,

Thomas
Dragan
#2 Posted : Friday, August 17, 2012 2:53:24 AM(UTC)
Rank: Advanced Member

Groups: Administrators, DataVizJavaScript, jQueryChart, jQueryDV, MvcChart, Registered
Joined: 1/3/2011(UTC)
Posts: 483

Thanks: 0 times
Was thanked: 87 time(s) in 87 post(s)
Hi,

You can check this sample:

http://www.jqchart.com/beta/samples/RealTime/ChartSeries

It shows how to add and remove series.
Best Regards,
Dragan Matek
jqChart Inc.
lung12
#3 Posted : Friday, August 17, 2012 12:57:12 PM(UTC)
Rank: Member

Groups: Registered
Joined: 8/16/2012(UTC)
Posts: 15

Thanks: 0 times
Was thanked: 0 time(s) in 0 post(s)
My project needs to remove the chart canvas for some cases. Any way to do that?
Dragan
#4 Posted : Friday, August 17, 2012 1:02:15 PM(UTC)
Rank: Advanced Member

Groups: Administrators, DataVizJavaScript, jQueryChart, jQueryDV, MvcChart, Registered
Joined: 1/3/2011(UTC)
Posts: 483

Thanks: 0 times
Was thanked: 87 time(s) in 87 post(s)
Try using 'destroy' method:

$('#selector').jqChart('destory')

http://www.jqchart.com/documentation/userguide/default.aspx#!ChartMethods
Best Regards,
Dragan Matek
jqChart Inc.
lung12
#5 Posted : Friday, August 17, 2012 1:15:48 PM(UTC)
Rank: Member

Groups: Registered
Joined: 8/16/2012(UTC)
Posts: 15

Thanks: 0 times
Was thanked: 0 time(s) in 0 post(s)
I tried it but it seemed not working. I used the sample from the trial version download and add a destroy button.
Any idea?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>HTML5 Chart jQuery Plugin - Creating Basic Chart </title>
<link rel="stylesheet" type="text/css" href="../css/jquery.jqChart.css" />
<script src="../js/jquery-1.5.1.min.js" type="text/javascript"></script>
<script src="../js/jquery.jqChart.min.js" type="text/javascript"></script>
<!--[if IE]><script lang="javascript" type="text/javascript" src="../js/excanvas.js"></script><![endif]-->
<script lang="javascript" type="text/javascript">
$(document).ready(function () {
$('#jqChart').jqChart({
title: { text: 'Chart Title' },
series: [
{
type: 'column',
data: [['a', 46], ['b', 35], ['c', 68], ['d', 30], ['e', 27], ['f', 85], ['d', 43], ['h', 29]]
},
{
type: 'line',
data: [['a', 69], ['b', 57], ['c', 86], ['d', 23], ['e', 70], ['f', 60], ['d', 88], ['h', 22]]
}
]
});


$('#button1').click(function() {
$('#jqChart').jqChart('destroy');
});

});


</script>
</head>
<body>
<input id="button1" type="button" value="Click to destroy a chart!" />
<br />
<br />
<div>
<div id="jqChart" style="width: 800px; height: 300px;" />
</div>
<div>This is a test</div>
</body>
</html>
Dragan
#6 Posted : Friday, August 17, 2012 1:19:33 PM(UTC)
Rank: Advanced Member

Groups: Administrators, DataVizJavaScript, jQueryChart, jQueryDV, MvcChart, Registered
Joined: 1/3/2011(UTC)
Posts: 483

Thanks: 0 times
Was thanked: 87 time(s) in 87 post(s)
You have a typo. Use:

$('#jqChart').jqChart('destroy');

instead of:

$('#jqChart').jqChart('destORy');

Best Regards,
Dragan Matek
jqChart Inc.
lung12
#7 Posted : Friday, August 17, 2012 1:24:47 PM(UTC)
Rank: Member

Groups: Registered
Joined: 8/16/2012(UTC)
Posts: 15

Thanks: 0 times
Was thanked: 0 time(s) in 0 post(s)
Oops, I fixed the typo but still not working.
Any idea? Thanks.
Dragan
#8 Posted : Friday, August 17, 2012 1:33:00 PM(UTC)
Rank: Advanced Member

Groups: Administrators, DataVizJavaScript, jQueryChart, jQueryDV, MvcChart, Registered
Joined: 1/3/2011(UTC)
Posts: 483

Thanks: 0 times
Was thanked: 87 time(s) in 87 post(s)
I sent you a fixed version via email.
Best Regards,
Dragan Matek
jqChart Inc.
lung12
#9 Posted : Friday, August 17, 2012 1:43:46 PM(UTC)
Rank: Member

Groups: Registered
Joined: 8/16/2012(UTC)
Posts: 15

Thanks: 0 times
Was thanked: 0 time(s) in 0 post(s)
Very good. This updated version works.
Thanks a lot!

Regards,

Thomas
Users browsing this topic
Guest (2)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

FlatEarth Theme by Jaben Cargman (Tiny Gecko)
Powered by YAF 1.9.4 | YAF © 2003-2010, Yet Another Forum.NET
This page was generated in 0.149 seconds.