Does the Mapbox Sheet Mapper plugin only read Google Sheet column data as strings? - mapbox-gl-js

I am using Mapbox's Sheet Mapper plugin and trying to use a data step expression to colour circles using numbers in a column labelled "Sales Value" in the Google Sheet.
This is the data step expression I'm trying:
"circle-color": [
"step",
["get", "Sales Value"],
"#51bbd6",
100,
"#f1f075",
2000,
"#f28cb1"
]
(I am following the Create and Style Clusters demo for the step expression https://docs.mapbox.com/mapbox-gl-js/example/cluster/)
However, the circles are black, not coloured, and the message is "Expected value to be of type number, but found string instead."
The "Sales Value" column in my Google Sheet is definitely formatted as numbers, e.g. 2000.
Does this mean that the Sheet Mapper plugin treats all Google Sheet data as strings?
Is there anything I can do to make the Mapbox data expression understand the column data as numbers not strings?
Thank you to anyone who can help.

Worked it out. Needed to add an explicit instruction "to-number" as part of the expression. This works:
"circle-color": [
"step",
["to-number", ["get", "Sales Value"]],
"#51bbd6",
100,
"#f1f075",
2000,
"#f28cb1"
]

Related

Cannot get correct type of chart: xlColumnStacked "variant 2" through vba code

I cannot assign the correct type of chart through VBA-code,
the type I need is "xlColumnStacked variant number 2"
Wanted variant
The code is run is the following:
ActiveSheet.ChartObjects("Chart 3").Activate
ActiveChart.ChartArea.Select
ActiveChart.ChartType = 52 'or synonymously : ActiveChart.ChartType = xlColumnStacked
This do not occur if the plot is already of the stacked format (still type 52 / xlColumnStacked), either in "bar og column"-stacked mode.
However, if I change the series which are displayed in the plot, the chart goes to "default" and I struggle to find any vba-code wise way to get back to the format which I want (see picture).
The thing is that I print these, for 80 series, and I hope to make that automated...
Received vba variant
I have had the same problem with changing line style on markers in scatter plot mode too, which made the same changes to the lines (between the markers) in the scatter plott.
The problem is that the name of the object is overlapping with another name it seems.
I (and also a helper from Microsoft) found a partial solution:
https://answers.microsoft.com/en-us/msoffice/forum/all/cannot-get-correct-type-of-chart-through-vba-code/ef57be1a-fab5-42a9-8d18-4af79e0cd5b2?messageId=9f8d32f2-d53d-449f-aa44-6d076ed5a1fe

power bi filled maps wont plot for the state of UT

I am having an issue getting the filled map visual to work.
Would appreciate any pointers to correct this issue.
I am trying to create a filled map visual to show:
a) Count of Providers in the State (this count also controls the
color saturation on the map)
b) Count of Networks in the State
The data is setup like this:
The map fills correctly, except for the state of Utah,
If I create a "Table" visual with the same data,
the counts for Utah show up correctly (so I know it is not a data or calculation issue).
I have set the "State" field in Power BI Modeling to a Data Category of "State or Province"
I have tested the following as part of my troubleshooting:
1) Replacing all the state abbreviations with fully spelled state names
(eg replace "UT" with "Utah", and it still will not plot)
2) If I change the Map configuration to use Zipcodes instead of the State, the map will plot the zip codes correctly for the state of UT.
Screen shot of the map with UTAH not filled in, and the data used to fill the map....
I have a kludgy solution to this problem.
It involves creating a new column in the table with the following formula:
US_States = IF('TableName'[AddressState]="LA","Louisiana,USA",'TableName'[AddressState]&",USA").
What this does is add a ",USA" suffix to each state abbreviation, and if the state="LA", spell out the state to "Louisiana, USA"- this is because Bing maps would otherwise plot LA as "Los Angeles" (good grief!).
You must set the new column of "US_States to a data category of "Place"
Hope someone else can benefit from this post. –

yadcf autocomplete not working as in original examples

In the older examples of the AutoComplete filter, as soon as you typed in a letter the filtering was applied reducing the numbers of rows shown. For example, if I typed the letter "x", only rows with that column containing the letter "x" would be displayed.
{ column_number : 1, filter_type: "auto_complete" },
In the newer examples, the AutoComplete filter does not do this. I want the original functionality for my web page - how do I achieve this? Is there an option I need to pass to the AutoComplete plugin via the filter_plugin_options parameter? Or is there a different filter I should be using?
I can't recall that aytocomplete ever worked this way, you need to use the filter_type: 'text' instead, see the fourth column in the following showcase page
IMO triggering the filter on each keyboard type fits better the text filter rather then autocomplete

Stepped Stacked chart not seen as EmbeddedChart in Google sheets API?

I am working with a spreadsheet that contains multiple sheets. In every sheet there is 1 chart.
I am using Google Apps Script to get these specific charts, which is working perfectly for all types of charts, except for the 'Stepped Stacked Chart', not to confuse with the 'Stepped Chart'.
Example code to explain the issue:
function getCharts(){
var ss = SpreadsheetApp.getActiveSpreadsheet();
var steppedStackedSheet = ss.getSheetByName('chart_2');
var otherChart = ss.getSheetByName('chart_1');
Logger.log(steppedStackedSheet.getCharts()); // returns an empty array
Logger.log(otherChart.getCharts()); // returns an array [EmbeddedChart] - This is what i also expect to see in the steppedStackedSheet chart.
}
I am buidling a script that downloads the chart as an image, but it's strange that this specific chart is not being recognized as a chart.
Haven't found anything on Google but hopefully someone here has had a similar issue and/or a solution.
Here an example sheet, also including the script
Thanks in advance!
As described in this documentation,
For 100% stacking, the stacks of elements at each domain-value are rescaled such that they add up to 100%. The options for this are isStacked: 'percent', which formats each value as a percentage of 100%, and isStacked: 'relative', which formats each value as a fraction of 1. There is also an isStacked: 'absolute' option, which is functionally equivalent to isStacked: true.
You may use setStacked() which uses stacked lines, meaning that line and bar values are stacked (accumulated). By default, there is no stacking. The return type is EmbeddedColumnChartBuilder.

Round up double value in jasper report

I have a textfield in jasper report as follows :
<textFieldExpression class="java.lang.Double"><![CDATA[$V{v_vcTotal}]]></textFieldExpression>
I want to round up this value using HALF_UP rounding mode.Can i achieve this in a simple way.Thanks in advance.
EDIT : I dont want to change my java class. Is there anything i can do in jasper jrxml file.
So all credit to #utkarsh their expression is so far the only working one I've seen online that converted my 'double' numbers pulled onto my report, my expression:
$f{balance}
Would produce doubles from a calculated field in my database like "-1365.00000000003"
In the Expression editor (in lieu of changing it in the source tab) I wanted to pull 2 sig figs from the number for looks. I added this expression and I stopped getting "compilation" errors and the wanted results:
new BigDecimal($F{balance}).setScale(2, BigDecimal.ROUND_HALF_DOWN).toString()
Result would be "-1365.00"
From what I've read this is a bit overkill to get the desired result but I am also under a deadline so I will try to optimize some other time.