I have added a geojson to my map. One of the feature's properties is called delay - it contains numbers between 0 and 160. Below, I have tried to make line-width a function of the value in this property (using this link as an example), just as one would style color. In fact, I would like it to be a mathematical function ( sqrt(delay) as opposed to using categories), but in either case I receive a syntax error in the console every time unexpected ")", suggesting that one cannot style line-width in the same way as color. What would be the best workaround in Mapbox JS GL?
map.on('load', function () {
map.addSource("routes", {
"type": "geojson",
"data": "simplify_830.geojson"
});
map.addLayer({
"id": "routes",
"type": "line",
"source": "routes",
"layout": {},
"paint": {
"line-color": "#FFA500",
'line-width': {
property: 'delay',
stops: [
[0, 2],
[20, 4],
[40, 6],
[60, 8],
[80, 10],
[100, 12],
[120, 14],
[140, 16],
[160, 20]
]
},
"filter": ["==", "name", ""]
});
We don't yet support data-driven styling for line properties.
We plan to add it very soon per http://github.com/mapbox/mapbox-gl-js/issues/2729.
My apologies for not more clearly communicating the state of data-driven styling support. A colleague of mine is working on a support table now! https://github.com/mapbox/mapbox-gl-style-spec/pull/465
Related
I'm using autotable in jsPDF to create index page,
my code looks likes this :
let page_3_main_title = "Index";
pdf.setFontSize(12);
pdf.setFontType("Times New Roman");
pdf.text(page_3_main_title, 105, 20, "center");
var page_3_title = ['Sr No.', 'Particulars', 'Page No']
var page_3_body = [
[1, "Location and location sketch"],
[2, "Details of beds"],
[3, "Seed details"],
[4, "Pre-treatment of Seeds"],
[5, "Details of Sowing"],
[6, "Watering"],
[7, "Plant/Seedlings Protection measure"],
[8, "Observations"],
[9, "Inspection Notes"],
[10, "Cost Analysis"],
[11, "Details of Disposal of Seedlings"],
[12, "Photograph"],
];
pdf.autoTable(page_3_title, page_3_body, { theme: "grid" });
I'm able to print the index in a table but the text "INDEX" above the table is not printing, what might be the reason?
I think you had the same issue as I had.. you need to adjust the y axis coordinate of the starting point of your table. Add the option startY: 75 to your autotable creation function and it will be set lower so you will see your text as it should be the case.
should look like:
*pdf.autoTable(page_3_title, page_3_body, startY: 75, { theme: "grid" });*
I have a chart in which hovering shows all the elements represented by bars, but they are too many and this produces problems such as the appearance of a scrollbar.
I would like to know if there is a way to show only the current bar that is hovering. In the c3.js documentation I see that this property exists to change the content of the tooltip, but I don't know how to get the current bar to which it is hovering.
With this:
tooltip: {
contents: function (d, defaultTitleFormat, defaultValueFormat, color) {
console.log(d, defaultTitleFormat, defaultValueFormat, color);
return "fds";
}
this is my live code:
var query = [
["x", "Usuarios"],
["Berta Arroyave", 53],
["Rogelio Zuluaga", 52],
["Manrique Perez", 42],
["Justin Vargas", 33],
["Believer qw", 28],
["María Jimenez", 14],
["Nairo Quintan", 12],
["Adriana Cardona", 11],
["Departamento Idio", 9],
["Natalia Benjumea", 7],
["Bibliotecatos", 7],
["Jose Herrera", 7],
["Doralibia", 6],
["Secretaría General ", 6],
["Natalia Ochoa", 6],
["Viviana Cano", 5],
["Erika Valencia", 5],
["Sandra Cañon", 3],
["Lina Constanza Suaza", 3],
["Recepción User", 2],
["Facultad Medicina ", 2],
["Sandra Valencia", 2],
["Luz Sepulveda", 2],
["Heidy Zapata", 2],
["Gabriela García", 2],
["Auxiliar Administrativo", 2],
["Adriana Mejia", 2],
["Administrador", 1],
["Nathaly", 1]
]
c3.generate({
data: {
x: 'x',
columns: query,
type: 'bar'
},
axis: {
x: {
type: 'category' // this needed to load string x value
}
}
});
how can I do it?
https://jsfiddle.net/50uej3at/
I think your problem here is that your data is in the wrong format to what you appear to be aiming for... rather than having one entry per category you've got one category with everything as an entry within it...
If you put this line after your query data definition:
query = d3.transpose(query);
You should get one bar per person and no massive tooltips
https://jsfiddle.net/yta1s9cz/1/
(I also adjusted the axis label rotation to make the labels readable)
I have a symbol layer displaying text on a mapbox map and I am looking for a way to change the opacity of the text.
this.map.addLayer({
"id": "symbols",
"type": "symbol",
"source": "source_circleCurrentGpsCircle",
"layout": {
"text-font": ["Open Sans Regular"],
"text-field": '{title}',
"text-size": {
stops: [
[0, 0],
[22, metersToPixelsAtMaxZoom * 2]
],
base: 2
}
},
"paint": {
"text-color": "#00FF00"
}
});
I tried a few things like the following
this.map.setPaintProperty('symbols', 'symbol-opacity', .6);
I think I just need the correct property name. Is it possible to set a class for the symbol? I could adjust the opacity easily that way.
I figured it out. It turns out to be the text-opacity property, not symbol-opacity. Seems obvious now.
To change the opacity on a label from a symbol type layer use the text-opacity property. Here's the documentation.
Example:
this.map.setPaintProperty('layer_name', 'text-opacity', .6);
I would like to find an approach on how to draw 2 lines in ECharts and fill up the space between them like this:
So that each line has it's own color. Depending on order of lines - area is filled into one color or another (see image).
Is there a native way of doing it? I found that some people are mentioning extensions, but nobody is providing any kind of instructions on how to write them from scratch.. Nor I found any examples on official documentation page. I would appreciate if somebody could point me to correct direction on how to achieve this goal.
In the worst case - I would accept other libraries if they have such very needed option.
The best I could do is this:
var chartOptions = {
xAxis: [{
type: 'value'
}],
yAxis: [{
type: 'value'
}],
series: [{
type: "line",
data: [[0, 4], [1, 3], [2, 2], [3, 2], [4, 1], [5, 2]],
}, {
type: "line",
data: [[0, 2], [1, 3], [2, 4], [3, 8], [4, 5], [5, 0]],
}],
};
var aChart = echarts.init(document.getElementById('aGraph'));
aChart.setOption(chartOptions);
I've used areaStyle to fill the area between the axisLine and the data. I would try to solve this issue by adding the green/yellow areaStyle to the green series, adding a pink areaStyle to the red series, and then adding a white areaStyle to a new series made up from the min values from the other two series. Combined with a lineStyle with a width of 0, you could mostly achieve the look in the sketch, however, the minimum series fill would probably also obscure the interior grid lines.
I have bar chart in high chart. I send it items for x & y. It happened that x-values are numerics. In such case, it assumes that there are missing entries and add the missing entries. I want to force high chart not to include those assumed items. Is that possible without using categories?
http://jsfiddle.net/96bk4661/1/
$(function () {
$('#container').highcharts({
"chart": {
"type": "column"
},
"series": [{
"name": "X-Axis",
"data": [
[1, 77926],
[2, 71245],
[4, 75275],
[5, 78175],
[6, 75369],
[7, 78145],
[8, 77638],
[9, 75706],
[12, 77491]
],
"color": "#1AA4D5"
}]
});
});
This one is different from http://stackoverflow.com/questions/15973457/automatically-join-missing-data-gaps-in-highcharts-js
I don't want the values to be included on the x-axis.
Use highstock and then set ordinal parameter as true.
xAxis:{
ordinal:true
},
Example: http://jsfiddle.net/96bk4661/2/
Seems there's no other way and I am using categories. Thanks #Ondkloss !