I wanted to use date picker from this side and I received this error:
mdDateTimePicker.js:80 Uncaught TypeError: (0 , _moment2.default) is not a function
This is my script
var dialog = new mdDateTimePicker.default({
type: 'date'
});
var toggleButton = document.getElementById('dataPicker');
toggleButton.addEventListener('click', function() {
dialog.toggle();
});
I think you are missing moment.js library to your example
Please note that moment.js must be loaded before mdDateTimePicker.js
<script src="js/moment.js"></script>
<script src="js/mdDateTimePicker.js"></script>
I also try you code here
Related
Using the tutorial from google on using a spreadsheet as data for a chart I have created the following.
Tutorial
<head>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load('current', {packages: ['corechart']});
google.charts.setOnLoadCallback(drawChart);
function drawSheetName() {
var query = new google.visualization.Query('https://docs.google.com/spreadsheets/d/15l3ZK45hv2ByOfkUiAKoKp-Z9a1u1-Q_rsLS7SqC51E/editgid=0&headers=1');
query.send(handleQueryResponse);
}
function handleQueryResponse(response) {
if (response.isError()) {
alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage());
return;
}
var data = response.getDataTable();
var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
chart.draw(data, { height: 400 });
}
}}
</script>
</head>
<body>
<!-- Identify where the chart should be drawn. -->
<div id="chart_div"/>
</body>
However no chart resolves, I have made the link public.
If I share the link it is https://docs.google.com/spreadsheets/d/15l3ZK45hv2ByOfkUiAKoKp-Z9a1u1-Q_rsLS7SqC51E/edit?usp=sharing
Following the docs and not sure where my error is.
This SO answer more about drive-sdk creates the key from a script from a new file, I don't really understand it and nuclear how you can obtain the correct URL for existing spreadsheets.
Would be great if there could be a consolidated answer obtaining correct sheets URL's.
Is this what you are trying to achieve?
If yes, you can check how it works here.
EDIT
Since I notice in the comments you want to query the spreadsheet and not use the entire spreadsheet, this is the logic to query with.
First, these are the basic components of the url to query:
var BASE_URL = "https://docs.google.com/a/google.com/spreadsheets/d/";
var SS_KEY = "stringSS_Key";
var BASE_QUERY = "/gviz/tq?tq=";
var partialUrl = BASE_URL + SS_KEY + BASE_QUERY;
Notice the BASE_QUERY variable
The first bit of the url is in the partialUrl variable.
Then, you need to use the Query Language that google provides. An example would be:
var queryToRun = 'select dept, sum(salary) group by dept';
You then need to call encodeURIComponent() on it, and add it to the partial URL. The final URL then becomes
var finalUrl = partialUrl + encodeURIComponent(queryToRun);
Only then you can run the google.visualiation.query as I suspect you intend.
var query = new google.visualization.Query(finalUrl);
I have used the following code for date time picker but not working it is not considering datetimepicker as a function.......all the files have been uploaded and used correctly for one page it is working fine and for the other it is not working can any one tell where the problem is???
var addrLoad = true;
var j$ = jQuery.noConflict();
j$(document).focusin(function() {
j$('.needsDatePicker').datetimepicker({
timeFormat: 'HH:mm',
dateFormat: 'yy-mm-dd',
}).removeClass('needsDatePicker');
});
I'm using two DateTimePickers http://tarruda.github.io/bootstrap-datetimepicker/ in my code: one for choosing a date (pickTime disabled) and the other for the time (pickDate disabled).
I've managed to set a startDate for the date, but how can I set a startTime and an endTime, in such a way that the any time before that startTime is disabled?
<script type="text/javascript">
$(function() {
$('#datetimepicker4').datetimepicker({
pickTime: false,
startDate: new Date(2013,9,8)
});
});
</script>
<script type="text/javascript">
$(function() {
$('#datetimepicker3').datetimepicker({
pickDate: false,
startTime: ???
});
});
</script>
This question is OLD but thought it might help some one.
JS
$('.time').datetimepicker({
format: 'LT'
}).on("dp.change",function(e){
var date = e.date;//e.date is a moment object
var target = $(e.target).attr('name');
console.log(date.format("HH:mm:ss"))//get time by using format
})
e.date is a moment object thus time can derived by using format("HH:mm:ss")
I am trying to display and update HLINEAR GAUGE fusionGadget pointer value. When I am dragging the pointer , the function FC_ChartUpdated is not being called. I have tried using RealtimeUpdateComplete eventListener too. But it displays error 'Object does not support property / method 'setAttribute''..Can you please tell me the reason?
We have to call that JS function or It will be called automatically when Gauge is updated?
Here is my code,
<html>
<head>
<title>FusionGadgets</title>
<script language="JavaScript" src="FusionCharts.js"></script>
</head>
<body bgcolor="#ffffff">
<div id="chartdiv" align="center">FusionGadgets</div>
<script type="text/javascript">
var myChart = new FusionCharts("HLinearGauge.swf", "myChartId", "450", "120", "0", "0");
myChart.setDataURL("Data.xml");
myChart.render("chartdiv");
</script>
</body>
<script>
FusionCharts("myChartId").addEventListener("RealtimeUpdateComplete" , myChartListener);
function myChartListener(){
alert('Hi.');
}
function FC_Rendered(DOMId)
{ //alert(Math.round(pointerValue));
//Check if DOMId is that of the chart we want
if (DOMId=="myChartId"){
//Get reference to the chart
var chartRef = FusionCharts(DOMId);
//Get the current value
var pointerValue = chartRef.getData(1);
//You can also use getDataForId method as commented below, to get the pointer value.
//var pointerValue = chartRef.getDataForId("CS");
//Update display
alert(Math.round(pointerValue));
}
}
</script>
</html>
Finally,After had been working for several hours,this issue has been resolved.These are the steps which made the issue was resolved...
1.passing registerWithJs value '1'.
var myChart1 = new FusionCharts("HLinearGauge.swf", "myChartId1", "450", "105", "0", "1");
2.Changed Flash Player Global Security Settings..
for more info
3. Chang the FusionCharts.js file to new version.
4.After had made these changes,I encountered with new issue,
chartRef.getData(1) gives javascript error (Object does not support the property/method).
So then I changed the code for getting chart reference
to
var chartRef = getChartFromId(DOMId);
from
var chartRef = FusionCharts(DOMId);
here is my code. as a result, it can't format any date according to the datePattern.
thank you for any help in advance
<script type="text/javascript">
var store = new dojo.data.ObjectStore({objectStore:new dojo.store.Memory({data:[{MyDate:new Date(2011,1,1)},{MyDate:new Date(2011,1,1)}]})});
dojo.addOnLoad(function()
{
var layout=
[
{field:"MyDate",datatype:"date",dataTypeArgs:{datePattern:"yyyy"}}
];
Grid = new dojox.grid.EnhancedGrid(
{
id:"Grid",
selectable:true,
store: store,
structure: layout,
});
Grid.placeAt("GridLayer");
Grid.startup();
});
</script>
<div id="GridLayer" style="width:98%;height:600px"></div>
Docs are being improved for this. Look at the current staging docs for DataGrid near the bottom where it says "See Also" the link for "Demos on how to display and edit date value in grid cells"