{
"containerId":"chart",
"dataTable":{
"cols":[{"label":"A","type":"string"},{"label":"B","type":"number"}],
"rows":[{"c":[{"v":"Online"},{"v":100}]}]
},
...
}
http://charts.hohli.com/new/embed.html?created=1459573342411#w=640&h=480&d={"containerId":"chart","dataTable":{"cols":[{"label":"A","type":"string"},{"label":"B","type":"number"}],"rows":[{"c":[{"v":"Online"},{"v":100}]}]},"options":{"hAxis":{"useFormatFromData":true,"viewWindow":{"max":null,"min":null},"minValue":null,"maxValue":null},"vAxes":[{"useFormatFromData":true,"viewWindow":{"max":null,"min":null},"minValue":null,"maxValue":null},{"useFormatFromData":true,"viewWindow":{"max":null,"min":null},"minValue":null,"maxValue":null}],"booleanRole":"certainty","width":600,"height":371,"min":0,"max":1000,"greenFrom":200,"greenTo":400,"yellowFrom":400,"yellowTo":800,"redFrom":800,"redTo":1000},"state":{},"view":{},"isDefaultVisualization":false,"chartType":"Gauge"}
SELECT
user.`id`,
user.`login`,
COALESCE(salary_table.`money_sum`, 0)-COALESCE(spending_table.`money_sum`, 0) AS 'sum'
FROM
`user`
LEFT JOIN (
SELECT
salary.user,
SUM(salary.`money`) AS 'money_sum'
FROM salary
GROUP BY salary.`user`
) salary_table ON salary_table.`user`= user.`id`
LEFT JOIN (
SELECT
spending.user,
SUM(spending.`money`) AS 'money_sum'
FROM spending
GROUP BY spending.`user`
) spending_table ON spending_table.`user`= user.`id`
GROUP BY user.`id`
// получить максимальный ID
var a = [];
$('.news').find('a').each(function () {
var i = $(this).attr('id');
a.push(i);
});
var MaxId = Math.max.apply(null, a);
// получить ID первого элемента
var Id = $('.news a').first().attr('id');
// или
var Id = $('.news a:first-child').attr('id');
// получить ID последнего элемента
var Id = $('.news a').last().attr('id');
// или
var Id = $('.news a:last-child').attr('id');
// проверяем блок на пустоту
var a = $('.news');
if (a.length) {
// блок не пустой
var Id = $('.news a').first().attr('id');
if (Id) {
// переменная не пуста
// можно что-то делать
console.log(Id);
} else {
console.log('нет Id');
}
} else {
console.log('news пуст');
}