I'm working on with Highmaps and this is the one I use :
http://www.highcharts.com/maps/demo/data-class-ranges
In this map the colors for different countries goes from white to blue I want to change that to "Red to Blue" gradient like in this css example :
background: -webkit-linear-gradient(red, yellow, green, blue); /* For Safari 5.1 to 6.0 */
background: -o-linear-gradient(red, yellow, green, blue); /* For Opera 11.1 to 12.0 */
background: -moz-linear-gradient(red, yellow, green, blue); /* For Firefox 3.6 to 15 */
background: linear-gradient(red, yellow, green, blue); /* Standard syntax (must be last) */
How can I do that ?
You can specify colors in the colorAxis object.
colorAxis: {
dataClasses: [{
to: 3,
color: "red"
}, {
from: 3,
to: 10,
color: "yellow"
}, {
from: 10,
to: 30,
color: "green"
}, {
from: 30,
to: 100,
color: "blue"
}, {
from: 100,
to: 300,
color: "pink"
}, {
from: 300,
to: 1000,
color: "purple"
}, {
from: 1000,
color: "black"
}]
},
Hex values like #FF0000 work as well.
Working example: http://jsfiddle.net/8wcntpcz/
EDIT:
Docs: http://api.highcharts.com/highmaps#colorAxis.dataClasses
Related
SCSS
$colors: (
primary: red,
secondary: blue,
accent: #ddd,
) !default;
$colors: (
primary: green,
secondary: purple,
black: #000,
white: #fff,
);
#each $color, $value in $colors {
.alert-#{$color} {
color: $value;
}
}
Result
.alert-primary {
color: green;
}
.alert-secondary {
color: purple;
}
.alert-black {
color: #000;
}
.alert-white {
color: #fff;
}
I wanted to create a SASS framework something like bootstrap. Wanted to override theme colors. How can i merge these maps to get something like this? I want a simple solution.
Expected result
.alert-accent {
color: #ddd;
}
.alert-primary {
color: green;
}
.alert-secondary {
color: purple;
}
.alert-black {
color: #000;
}
.alert-white {
color: #fff;
}
You can use map-merge:
$colors: map-merge($colors, (
primary: green,
secondary: purple,
black: #000,
white: #fff
));
From the documentation, this function:
Returns a new map with all the keys and values from both $map1 and $map2.
This can also be used to add a new value or overrwrite a value in $map1, by passing a single key/value pair as $map2.
If both $map1 and $map2 have the same key, $map2’s value takes precedence.
Why this doesn't work?
#colors: {
red: #2A3F50;
}
.yyy{
#color: red;
color: #colors[ #color ];
}
Is in Less method to use variables with maps?
The error:
Variable #color not found
PS:
but this code works fine:
#colors: {
red: #2A3F50;
}
.yyy{
#color: red;
color: #colors[ red ];
background-color: #color;
}
If I put ##color in [ ], it throws Variable #red not found
How can I style the scrollbars with JSS? The solution below does not work.
'::-webkit-scrollbar-track': {
background: 'red',
},
'::-webkit-scrollbar': {
width: 10,
background: 'red',
},
'::-webkit-scrollbar-thumb': {
background: 'green',
},
In JSS, pseudo-elements are prefixed with an ampersand. Give the following a try:
'&::-webkit-scrollbar-thumb': {
background: '#888'
}
I have line geometry that I've styled using the dashArray option. I'm trying to add a black outline to distinguish the gaps on lighter basemaps.
I tried adding a black path underneath with a heavier weight to create the outline but it seems that the gaps are transparent.
Applying the following style to the respective layers creates a white line with a black outline:
path = {
color: '#ffffff',
weight: 3,
opacity: 1
}
outline = {
color: '#000000',
weight: 5,
opacity: 1
}
When I apply dashArray the bottom layer shows through:
path = {
color: '#000000',
weight: 3,
opacity: 1,
dashArray: '5,10'
}
outline = {
color: '#000000',
weight: 5,
opacity: 1
}
Is there a simple way to achieve this?
Leaflet path style options here.
EDIT: Top path is dashArray by itself. Second is when I overlay the dashArray on the wider black line (outline). Third is what I'm trying to achieve.
You could achieve the same effect with just 2 paths:
Background, continuous and wider.
Foreground, dashed and narrower. The background is visible through the gaps.
It is not exactly the same result, since if you want round caps, it is the white dashes that get them. But if you want actually square caps, as shown below, then you get the same effect:
var map = L.map("map").setView([0.4, 0], 8);
var coords = [
[0, -1],
[0, 1],
[1, 1]
];
// Background continuous black stroke, wider than dashed line.
L.polyline(coords, {
weight: 10,
lineCap: 'square', // Optional, just to avoid round borders.
color: 'black'
}).addTo(map);
// Foreground dashed white stroke, narrower than background.
L.polyline(coords, {
weight: 6,
dashArray: '5, 10',
lineCap: 'square', // Optional, just to avoid round borders.
color: 'white'
}).addTo(map);
<link rel="stylesheet" href="https://unpkg.com/leaflet#1.2.0/dist/leaflet.css">
<script src="https://unpkg.com/leaflet#1.2.0/dist/leaflet-src.js"></script>
<div id="map" style="height: 200px"></div>
The solution I came up with combines the two examples using three layers placing the dashArray path on top of the black-outlined layer.
//base layer black & wider to create outline
outline = {
color: '#000000',
weight: 5,
opacity: 1
}
//white line layer that will show through the transparent gaps
pathBackground = {
color: '#ffffff',
weight: 3,
opacity: 1
}
//dashed path is placed on top of the black-outlined white line
path = {
color: '#000000',
weight: 3,
opacity: 1,
dashArray: '5,10'
}
My code:
{
border: 1,
bodyStyle: 'margin:0 0 0 140px;',
style: {
borderColor: 'black',
borderStyle: 'solid', //margin:'0 0 0 140' //margin-left: '140px' }, width: 140, name: 'comp', id:'compId', triggerAction: 'all', mode: 'local', store: new Ext.data.SimpleStore({
fields: ['myId', 'displayText'],
data: [
[1, 'item1'],
[2, 'item2']
]
}), displayField: 'displayText', xtype: 'combo',
},
here in ext js 2.3 bodyStyle is not getting appended to the combobox.Can anyone suggest how to resolve this?
Thanks
I think this could be what you need.
{
xtype: 'combo'
style : 'margin-left: 140px; border: solid black 1px;',
name: 'comp',
id:'compId',
triggerAction: 'all',
mode: 'local',
store: new Ext.data.SimpleStore({
fields: ['myId', 'displayText'],
data: [
[1, 'item1'],
[2, 'item2']
]
}),
displayField: 'displayText',
valueField : 'myId'
}
Note there is no bodyStyle config option according to the docs - http://docs.sencha.com/extjs/2.3.0/#!/api/Ext.form.ComboBox
I removed the width option as with the margin-left style attribute (also 140px) I thought you may end up with something odd looking.
combo.js :
{xtype:'combobox', cls:'combo'}
combo.css:
.combo .x-boundlist-selected {
background: #757575;
background-image: -webkit-linear-gradient(top, #757575, #474747);
background-image: -moz-linear-gradient(top, #757575, #474747);
background-image: -ms-linear-gradient(top, #757575, #474747);
background-image: -o-linear-gradient(top, #757575, #474747);
background-image: linear-gradient(to bottom, #757575, #474747);
border: solid #4e4e4e 2px;
color: #ffffff;
text-decoration: none;
}
.combo .x-boundlist-item {
background: #757575;
background-image: -webkit-linear-gradient(top, #757575, #474747);
background-image: -moz-linear-gradient(top, #757575, #474747);
background-image: -ms-linear-gradient(top, #757575, #474747);
background-image: -o-linear-gradient(top, #757575, #474747);
background-image: linear-gradient(to bottom, #757575, #474747);
border: solid #4e4e4e 2px;
color: #ffffff;
text-decoration: none;
}
this is one of the code that used bodyStyle atribute in 2.3 version
this may help you.
this.itemCombo= new Ext.form.ComboBox({
name : "combooo",
fieldLabel : "Status",
displayField : 'combo',
valueField : 'id',
mode : 'local',
triggerAction : 'all',
hiddenName : "comboo",
editable : false,
width : 100,
store : this.store,
value : "0"
});
this.frmPanel = new Ext.form.FormPanel({
bodyStyle : "padding:10px",
border : true,
autoScroll : true,
layout : "table",
layoutConfig : {
columns : 1,
style : "vertical-align:top"
},
items : [{
bodyStyle : "padding-right:10px",
xtype : "panel",
layout : "form",
border : false,
labelWidth : 110,
colspan : 2,
items : [this.item1,this.itemCombo]
}]
});