Resizing component Rating of gluon - mobile

I'm trying to resize a Rating component by css and by code with this instruction:
Rating rating= new Rating();
rating.setPrefWidht(100);
rating.setPrefHeight(40);
But in both cases the rating doesn't resize!
Any helps?
Thanks in advance

As the Rating control seems to ignore the set prefSize, you have to set the size of the rating buttons, e.g.:
.rating > .container > .button{
-fx-min-width: 20;
-fx-min-height: 20;
-fx-max-width: 20;
-fx-max-height: 20;
}

Related

Applying color to table according to data coming from server?

Suppose -23% ....0%....100% is my data. For above 0% should show green shades and below red shades . Shades should be darker as the percentage is more . vice versa.
Any Solution?
use ng-class directive to add class basis on condition
For ex.
HTML
<input ng-model="shadesVariable" />
<div ng-class="{'class-green': shadesVariable > 0, 'class-red': shadesVariable < 0}"></div>
add same name classes in your CSS
.class-green {
color: #808080
}
.class-red {
color: #FF0000
}
If you want to change class value every time then use dynamic value or use inline style
for green shades i.e for positive percentage
First I have taken the max percentage and rounded to next 5th multiple value and then divided that rounded value by 5 . If suppose 7.6 is the highest value ,then the rounded value will be 10. so 10/5 is 2 . After this am creating an array. Here array will be [2,4,6,8].
Now am comparing each percentage an applying shades to it.
var dataPositive = [0.12, 4.5, 6.6, 8.9, 0.34, 1.34, 5.6, 9.8, 18.45];
var maxPositivePercent = Math.max(...dataPositive);
var roundUpToClosestValue = Math.ceil(maxPositivePercent / 5);
console.log(roundUpToClosestValue);
$scope.candlePositive = [1,2,3,4,5];
for(var i=0 ; i < $scope.candlePositive.length; i++ ) {
$scope.candlePositive[i] = $scope.candlePositive[i]
*roundUpToClosestValue;
}
$scope.candleColorPos = [
'#C8FFC8',
'#96FF96',
'#57f702',
'#59a033',
'#2b7c01'
];
Here is [a link] http://plnkr.co/edit/gaLEPX8n6efskp3I75bU?p=preview

angular-nvd3 change in multibar chart column width

I use angular-nvd3 library in my angular project.
I need to change column width in "multiBarChart". I tried to change on event "on-ready" but it doesn't work
onChartReady(scope, element) {
const api = scope.api;
const chart = scope.chart;
const svg = scope.svg;
var bars = svg.selectAll("rect.nv-bar");
bars.attr("width", "200");
}
You can use the below code snippet to change the width of the bar in multi bar chart.
groupSpacing property accepts a value between 0 and 1
A value of 0.1 will make the bars very wide. A value of 0.9 will make them narrow.
chart.groupSpacing(0.8); // Value must be between 0 & 1

stylus mixin with &:nth-of-type

I would like something like this
number(x)
&:nth-of-type(x)
Mostly just for readability - and for a basic example of when I might need to use the & in a mixin...
li //
number(1)
color: red
number(2)
color: blue
To yield...
li //
&:nth-of-type(1)
color: red
&:nth-of-type(2)
color: blue
Is this possible? Escaping ... ? ? ?
for my break-points... i use a variable --- but can't here
#media break-point-1 etc...
I'm afraid you can create shortcut like that
But you can use this mixin
setColors(colorList)
for col, index in colorList
&:nth-child({index})
color: col;
setColors(red blue);
This is a very old question and I am sure you found a solution a long time ago but there isnĀ“t an accepted answer and maybe is useful for other users.
To use variables in selectors, they must be enclosed in braces (interpolation). To get the content in the mixin, use the block mixin feature:
Stylus
number(x)
&:nth-of-type({x})
{block}
li
+number(1)
color red
+number(2)
color blue
CSS:
li:nth-of-type(1) {
color: #f00;
}
li:nth-of-type(2) {
color: #00f;
}

how to display an image with the grid.lua lib

i have found this lib for easily create a grid in lua but i can't assign an image on each cells.
https://github.com/CoderDojoSV/corona-game-template/blob/master/docs/grid.md
I have contacted the author of the grid.lua but no answer anymore.
Do you have the true syntax ? thanks for your help.
local grid = require("grid")
myGrid = grid.newGrid(5, 5, 500)
myGrid:eachSquare(function(doeach)
From what I see in documentation grid is based on rectangle objects, so you won't be able to assging image to grid directly.
But you can put image in each squares coordinates
Base on docs:
local myGrid = grid.newGrid(8, 8, 700)
myGrid:eachSquare(function(gridSquare)
local image = display.newImage(pathToYourImage)
image.x, image.y = gridSquare.displayObject.x, gridSquare.displayObject.y
end)
If you need reference in grid squares to image you can assign it to gridSquare
gridSquare.myImage = image
That way in every further eachSquare iteration you will have access to image reference.
i have found the solution
grille:eachSquare(function(gridSquare)
gridSquare.displayObject:setFillColor(0, 0, 0, 255)
gridSquare.displayObject.xScale=.1
gridSquare.displayObject.yScale=1
gridSquare.myImage = display.newImage("my2.png")
gridSquare.myImage.x = gridSquare.displayObject.x+35
gridSquare.myImage.y = gridSquare.displayObject.y
gridSquare.myImage.yScale=0.5
gridSquare.myImage.xScale=0.5
end)

Extjs4, Summary value of a grid column that even not checked(selected)

I need to sum of grid column. but I don't know how to get all the rows even not selected one.
For only selected I do,
(controller)
var sum =0;
var grid = this.getMyGrid().getSelectionModel.getSelection();
Ext.each(grid,function(item)){
sum += item.data.qty;
}
but How should I do to get grid data that include not selected row too?
Thank you!
this.myGrid().store.each(function() {
...
})

Resources