Have I defined it correctly??
<html>
<head>
<!--Load the AJAX API-->
<script type="text/javascript"
src="https://www.google.com/jsapi"></script>
<script type="text/javascript" src="jquery-1.9.1.min.js"></script>
<script type="text/javascript">
// Load the Visualization API and the controls package.
google.load('visualization', '1.1', {'packages':['controls']});
// Set a callback to run when the Google Visualization API is loaded.
google.setOnLoadCallback(drawDashboard);
// Callback that creates and populates a data table,
// instantiates a dashboard, a range slider and a pie chart,
// passes in the data and draws it.
function drawDashboard() {
var jsonChartData = $.ajax({
url: "getdata5.php",
dataType:"json",
async: false
}).responseText;
// Create our data table.
var chartdata = new google.visualization.DataTable(jsonChartData);
// Create a dashboard.
var dashboard = new google.visualization.Dashboard(
document.getElementById('dashboard_div'));
// Create a line chart, passing some options
var Chart1 = new google.visualization.ChartWrapper({
'chartType': 'AreaChart',
'containerId': 'chart_div1',
'options': {
'width': 900,
'height': 500,
'legend': 'top',
chartArea: {
left: "8%",
top: "10%",
width: "100%",
height: "80%",
},
vAxis: {
viewWindow: {
min: 0,
max: 2
}
} },
view: {
columns: [0,1,2,3] // use columns 0 and 2
},
});
// Create a line chart, passing some options
var Chart3 = new google.visualization.ChartWrapper({
'chartType': 'ColumnChart',
'containerId': 'chart_div3',
'options': {
'width': 1000,
'height': 500,
'legend': 'top',
'bar': { groupWidth: '100%' },
isStacked: true,
series: {
0: {
color: 'green'
}
},
chartArea: {
left: "8%",
top: "10%",
width: "100%",
height: "80%",
}
},
view: {
columns: [0,4,5] // use columns 0 and 2
},
});
// Create a range slider, passing some options
var RangeSlider = new google.visualization.ControlWrapper({
'controlType': 'ChartRangeFilter',
'containerId': 'filter_div',
'options': {
'filterColumnLabel': 'Start Time and Shut Down',
ui: {chartType: 'AreaChart',
chartOptions: {
chartArea: {
width: '90%'
},
height: 60,
}
}
}
});
// Establish dependencies, declaring that 'filter' drives
'LineChart',
// so that the line chart will only display entries that are let
through
// given the chosen slider range.
dashboard.bind(RangeSlider, [Chart1, Chart3]).draw(chartdata);
Chart3.clearChart();
Chart3.getchart();
// Draw the dashboard.
dashboard.draw(chartdata);
}
</script>
</head>
<body>
<!--Div that will hold the dashboard-->
<div id="dashboard_div">
<!--Divs that will hold each control and chart-->
<div id="chart_div1"></div>
<div id="chart_div3"></div>
<div id="filter_div"></div>
</div>
</body>
</html>
On Wednesday, April 15, 2015 at 11:09:50 PM UTC+5, Daniel LaLiberte wrote:
>
> Call chart.clearChart() each time before you call chart.draw() with
> different data. If you are using a chartWrapper, then you'll have to get
> the chart from the wrapper, using chartwrapper.getChart() so you can
> clearChart() on the chart rather than the wrapper.
>
> On Wed, Apr 15, 2015 at 2:00 PM, mariummalik22 <[email protected]
> <javascript:>> wrote:
>
>> clearChart() should be defined where? In the beginning of the script?
>>
>> On Wednesday, April 15, 2015 at 10:51:44 PM UTC+5, Daniel LaLiberte wrote:
>>>
>>> It could be a bug that, once you draw a chart, if you reuse the same
>>> chart with different data or options, it might remember the previous
>>> settings, such as the bar width. If this is a bug, a possible work around
>>> might be to call clearChart() on the chart before reusing it. Either way,
>>> let us know. Thanks.
>>>
>>> On Wed, Apr 15, 2015 at 1:30 PM, mariummalik22 <[email protected]>
>>> wrote:
>>>
>>>> It is on my own server. Could this thing be an issue, that first I
>>>> plotted Column Chart, whose values were too close and then I changed my
>>>> data and got this. Because the same thing happened with me before too.
>>>> Could it be a bug or something?
>>>>
>>>> On Wednesday, April 15, 2015 at 10:19:05 PM UTC+5, Daniel LaLiberte
>>>> wrote:
>>>>>
>>>>> If you can point me to a page that shows this, I will take a look.
>>>>>
>>>>> On Wed, Apr 15, 2015 at 1:03 PM, mariummalik22 <[email protected]>
>>>>> wrote:
>>>>>
>>>>>> But with same data values 2.png was plotted and it's width is
>>>>>> completely fine and I don't even have any other data
>>>>>>
>>>>>> On Wednesday, April 15, 2015 at 5:44:36 PM UTC+5, Daniel LaLiberte
>>>>>> wrote:
>>>>>>>
>>>>>>> The column chart computes the width of the columns based on the
>>>>>>> closest data values, so I would guess that somewhere in your data,
>>>>>>> not the part that is visible, you have two domain values that are very
>>>>>>> close. We don't yet have an option for specifying the column width
>>>>>>> any
>>>>>>> other way.
>>>>>>>
>>>>>>> On Wed, Apr 15, 2015 at 8:19 AM, mariummalik22 <[email protected]>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> When I am plotting column chart using dashboard the bars' width has
>>>>>>>> reduced to zero. (1.png) Although when I plotted the same data
>>>>>>>> separately
>>>>>>>> it's width is completely fine. (2.png) What could be the reason of it?
>>>>>>>>
>>>>>>>> My code where this chart is defined is:
>>>>>>>>
>>>>>>>> // Create a line chart, passing some options
>>>>>>>> var Chart3 = new google.visualization.ChartWrapper({
>>>>>>>> 'chartType': 'ColumnChart',
>>>>>>>> 'containerId': 'chart_div3',
>>>>>>>> 'options': {
>>>>>>>> 'width': 1000,
>>>>>>>> 'height': 500,
>>>>>>>> 'legend': 'top',
>>>>>>>> 'bar': { groupWidth: '100%' },
>>>>>>>> isStacked: true,
>>>>>>>> series: {
>>>>>>>> 0: {
>>>>>>>> color: 'green'
>>>>>>>> }
>>>>>>>> },
>>>>>>>> chartArea: {
>>>>>>>> left: "8%",
>>>>>>>> top: "10%",
>>>>>>>> width: "100%",
>>>>>>>> height: "80%",
>>>>>>>> }
>>>>>>>> },
>>>>>>>> view: {
>>>>>>>> columns: [0,4,5] // use columns 0 and 2
>>>>>>>> },
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> });
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> You received this message because you are subscribed to the Google
>>>>>>>> Groups "Google Visualization API" group.
>>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>>> send an email to
>>>>>>>> [email protected].
>>>>>>>> To post to this group, send email to
>>>>>>>> [email protected].
>>>>>>>> Visit this group at
>>>>>>>> http://groups.google.com/group/google-visualization-api.
>>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Daniel LaLiberte
>>>>>>> <https://plus.google.com/100631381223468223275?prsrc=2> -
>>>>>>> 978-394-1058
>>>>>>> [email protected] 5CC, Cambridge MA
>>>>>>> [email protected] 9 Juniper Ridge Road, Acton MA
>>>>>>>
>>>>>> --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "Google Visualization API" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>> send an email to
>>>>>> [email protected].
>>>>>> To post to this group, send email to [email protected]
>>>>>> .
>>>>>> Visit this group at
>>>>>> http://groups.google.com/group/google-visualization-api.
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Daniel LaLiberte
>>>>> <https://plus.google.com/100631381223468223275?prsrc=2> -
>>>>> 978-394-1058
>>>>> [email protected] 5CC, Cambridge MA
>>>>> [email protected] 9 Juniper Ridge Road, Acton MA
>>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Google Visualization API" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected].
>>>> To post to this group, send email to [email protected].
>>>> Visit this group at
>>>> http://groups.google.com/group/google-visualization-api.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>
>>>
>>> --
>>> Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2>
>>> - 978-394-1058
>>> [email protected] 5CC, Cambridge MA
>>> [email protected] 9 Juniper Ridge Road, Acton MA
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google Visualization API" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected]
>> <javascript:>.
>> To post to this group, send email to [email protected]
>> <javascript:>.
>> Visit this group at
>> http://groups.google.com/group/google-visualization-api.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2>
> - 978-394-1058
> [email protected] <javascript:> 5CC, Cambridge MA
> [email protected] <javascript:> 9 Juniper Ridge Road, Acton MA
>
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.