I am trying to put this code into a variable and then call that variable from phatom and phantom should generate graph eg: I save this code in var test="code" then I call test in phantomjs and it should generate the graph, is it possible?
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
series: [{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
}]
Or this can also help
Create js file and call this from a variable
phantomjs highcharts-convert.js -infile options1.json -outfile chart1.png -scale 2.5 -width 300 -constr Chart -callback callback.js
It is unclear from your question what exactly you are trying to accomplish. If you have
var test = { xAxis: { ... } };
and you are trying to access that variable from within a webpage (i.e. to generate the graph in the actual DOM) you have to pass the variable as an argument to the page open method, i.e.:
var test = { xAxis: { ... } };
var page = require('webpage').create();
page.open(function (someVar) {
...
// now you have access to the test variable via someVar
...
}, test);
If that is not what you are trying to accomplish, please clarify your question and I will do my best to help.
Related
I am looking for a way to show dependent dropdowns using reactive form with the help of dynamic Json.
Below is my main input json:
JsonObj = {
'Desktop': {
'pwdevices': {
'pwsize': 777,
'pwtype': 'mobile'
},
'pwid': 456,
'pwrules': 'generate'
},
'Laptop': {
'release': 'april',
'service': 'provisioning',
'sheerid': 123,
'sprint': {
'id': 990,
'support': 'desktop'
}
}
};
Dropdown should show the json keys like below:
Val 1: Desktop(selected)/laptop > pwdevices(selected)/pwid/pwrules > pwsize(selected)/pwtype > number
Val 2: Desktop/laptop(selected)> release/service/sheerid/sprint(selected)> id/support(selected) > string
And so on...
Each val/constructed dropdown row above will have a delete button. Clicking on it will delete corresponding val.
I want to create a pdf document with the package 'pdf'. The example on the dart - page is working fine: https://pub.dev/packages/pdf#-example-tab-
You can see that the table is static. I want to create a dynamic table in the pdf document.
The columns will be constant, but the rows have to be dynamic.
I have tried to insert a for() - loop.
The syntax is not correct.
pdfWidget.Table.fromTextArray(context: context, data: <List<String>> [
<String>['Date', 'PDF Version', 'Acrobat Version'],
//.....
//more Strings here.....
]),
I ran into the same issue.
This seemed to work for me.
pdf.addPage(
MultiPage(
build: (context) => [
Table.fromTextArray(context: context, data: <List<String>>[
<String>['Msg ID', 'DateTime', 'Type', 'Body'],
...msgList.map(
(msg) => [msg.counter, msg.dateTimeStamp, msg.type, msg.body])
]),
],
),
);
where my msgList object was a custom List, ie: List<SingleMessage>
There are several ways to do it, I prefer to fill the List separately, like:
List<List<String>> salidas = new List();
salidas.add(<String>['Title1','Title2', ... , 'Title n']);
for(var indice=0;indice<records.length;indice++) {
List<String> recind = <String>[
records[indice].Stringfield1,
records[indice].Stringfield2,
...,
records[indice].Stringfieldn
];
salidas.add(recind);
}
...
fpdf.Table.fromTextArray(context: context,data: salidas),
I am a developer curious about header bidding. I don't have demand partners. But I want to test the solution I build. Is it possible to create dummy bidders? Is there any open source code that can mimic a bidder?
You can use appnexus's dummy bidder used in their examples on prebid.org.
It's also available on jsfiddle
Here's the complete configuration:
var adUnits = [{
code: 'div-gpt-ad-1460505748561-0',
sizes: [[300, 250], [300,600]],
bids: [{
bidder: 'appnexus',
params: {
placementId: '10433394'
}
}]
},{
code: 'div-gpt-ad-1460505661639-0',
sizes: [[728, 90], [970, 90]],
bids: [{
bidder: 'appnexus',
params: {
placementId: '10433394'
}
}]
}];
Of course you could also take some else's live configuration, but the owners won't be happy to see your dummy bids
Aurelia project with TypeScript (tsc 2.1.4), JSPM and aurelia-materialize-bridge#0.20.6.
Project is multilingual (translations are in database and injected via "LanguageService" where needed) so we need translated instances of MdDatePicker too.
I found a way how to translate properties like monthsFull, monthsShort, today... per instance of MdDatePicker (pickadate.js picker's properties actually) on this way in view/view-model:
<input md-datepicker="container: body;value.two-way: fromDate;"
md-datepicker.ref="dpickerFrom"
type="date" placeholder=${dtPickTitle} />
attached(
var picker = (<any>this).dpickerFrom.picker;
var settings = picker.component.settings;
settings.monthsFull = this.languageService.datePickerTran.monthsFull; // e.g. [ 'Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember' ]
settings.today = this.languageService.datePickerTran.today; //e.g."Heute"
picker.render(true);
)
I have tried to reach needed properties globally in App.ts:
import * as bridge from 'aurelia-materialize-bridge';
constructor (){
bridge.MdDatePicker.prototype;//Can't find where to put translations
}
but I could not find needed.
Is this right approach at all?
Considering given platform, is there any way to set this properties (defaults) on one place for all instances?
I've told the OP to post my answer back here. So here it goes.. :-)
There is an options bindable here: https://github.com/aurelia-ui-toolkits/aurelia-materialize-bridge/blob/master/src/datepicker/datepicker.js#L19
That object is merged here: https://github.com/aurelia-ui-toolkits/aurelia-materialize-bridge/blob/master/src/datepicker/datepicker.js#L64
And the result is used to initialize the datepicker here: https://github.com/aurelia-ui-toolkits/aurelia-materialize-bridge/blob/master/src/datepicker/datepicker.js#L76
Now, if you visited the links you may have seen a commented example of an i18n config here (German strings): https://github.com/aurelia-ui-toolkits/aurelia-materialize-bridge/blob/master/src/datepicker/datepicker.js#L47-L60
So, if you set the i18n properties in the options bindable, it could work..
<input
md-datepicker="container: body; value.two-way: selectedDate; options.bind:i18nOptions;"
type="date" placeholder="pick a date"/>
Where i18nOptions might be:
{
selectMonths: true, // Creates a dropdown to control month
selectYears: 15, // Creates a dropdown of 15 years to control year
monthsFull: [ 'Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember' ],
monthsShort: [ 'Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez' ],
weekdaysFull: [ 'Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag' ],
weekdaysShort: [ 'So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa' ],
today: 'Heute',
clear: 'Löschen',
close: 'Schließen',
firstDay: 1,
format: 'dddd, dd. mmmm yyyy',
formatSubmit: 'yyyy/mm/dd'
}
I definitely want to make it more explicit.
I have a similar answer
In my view I have
<div class="input-field col s6">
#Html.EditorFor(model => model.FECHAI_VIG, new { htmlAttributes = new { #id = "fechai_vig", #class = "form-control datepicker", #onkeyup = "borrar(this);" } })
#Html.LabelFor(model => model.FECHAI_VIG, "De", htmlAttributes: new { #class = "active" })
</div>
And in the script
<script>
var elemth = document.querySelector('#fechai_vig');
var optionsth = {
format: 'dd/mm/yyyy',
i18n: {
clear: 'Limpiar',
today: 'Hoy',
done: 'Seleccionar',
previousMonth: '‹',
nextMonth: '›',
months: ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'],
monthsShort: ['Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Oct', 'Nov', 'Dic'],
weekdaysShort: ['Dom', 'Lun', 'Mar', 'Mie', 'Jue', 'Vie', 'Sab'],
weekdays: ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'],
weekdaysAbbrev: ['D', 'L', 'M', 'X', 'J', 'V', 'S']
}
};
var instanceth = M.Datepicker.init(elemth, optionsth);
</script>
im using jquery validation and have a date field, using jquery i applay the datepicker to the edit field:
HTML:
<p>#Html.TextBoxFor(m => m.rol.fecha_expiracion, new { #id = "AdmPermfechaHastaNuevoRol" })
#Html.ValidationMessageFor(m => m.rol.fecha_expiracion)
script:
$(function () {
$("#AdmPermfechaHastaNuevoRol").datepicker({
changeMonth: true,
changeYear: true,
minDate: 0
});
});
now im from argentina, and i need to format my date fields, so i have a script to change the datepiker format:
jQuery(function ($) {
$.datepicker.regional['es'] = {
closeText: 'Cerrar',
prevText: '<Ant',
nextText: 'Sig>',
currentText: 'Hoy',
monthNames: ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'],
monthNamesShort: ['Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Oct', 'Nov', 'Dic'],
dayNames: ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'],
dayNamesShort: ['Dom', 'Lun', 'Mar', 'Mié', 'Juv', 'Vie', 'Sáb'],
dayNamesMin: ['Do', 'Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sá'],
weekHeader: 'Sm',
dateFormat: 'dd/mm/yy',
firstDay: 1,
isRTL: false,
showMonthAfterYear: false,
yearSuffix: ''
};
$.datepicker.setDefaults($.datepicker.regional['es']);
});
the problem im having is that when i use jqueryu validate on my form using chrome, and try to post the form i get a validation error (jquery validation error) that says somthing like "fecha_expiracion ust be a date"
as u can see from the datepiker config script i format my date like:'dd/mm/yy'
and that is the problem, if the date i put is somthing like 10/5/2012 is ok, but if i put 25/5/2012 BUM!!! so i guess is trying to parse to json the date like mm/dd/yy, does any know how to fix this? any ideas or directions? tks
EDIT:
i try this
http://www.codeproject.com/Tips/579279/Fixing-jQuery-non-US-Date-Validation-for-Chrome
only get this:
ncaught RangeError: Invalid language tag: 24/07/2013
Here you can find a similar problem description and a workaround.
Optionally, you can use the jQueryUI Datepicker validation plugin.