wonder if you could help me out on the below.
I´m using Deneb to visualize small multiples in PBI and I´m not able to find out how to add text labels above/below the bar.
Does anyone know the workaround by chance?
Here´s the code that I´m using so far:
{
"data": {"values": [
{"Region":"A","Month":"1","Difference":"-0.01"},
{"Region":"A","Month":"2","Difference":"0"},
{"Region":"A","Month":"3","Difference":"-0.03"},
{"Region":"A","Month":"4","Difference":"-0.01"},
{"Region":"A","Month":"5","Difference":"-0.01"},
{"Region":"A","Month":"6","Difference":"0.05"},
{"Region":"A","Month":"7","Difference":"-0.05"},
{"Region":"A","Month":"8","Difference":"-0.03"},
{"Region":"A","Month":"9","Difference":"0.03"},
{"Region":"A","Month":"10","Difference":"-0.01"},
{"Region":"A","Month":"11","Difference":"-0.01"},
{"Region":"A","Month":"12","Difference":"0.03"},
{"Region":"B","Month":"1","Difference":"-0.02"},
{"Region":"B","Month":"2","Difference":"-0.02"},
{"Region":"B","Month":"3","Difference":"0.02"},
{"Region":"B","Month":"4","Difference":"0.03"},
{"Region":"B","Month":"5","Difference":"-0.05"},
{"Region":"B","Month":"6","Difference":"-0.02"},
{"Region":"B","Month":"7","Difference":"-0.01"},
{"Region":"B","Month":"8","Difference":"0.03"},
{"Region":"B","Month":"9","Difference":"-0.03"},
{"Region":"B","Month":"10","Difference":"-0.03"},
{"Region":"B","Month":"11","Difference":"0.01"},
{"Region":"B","Month":"12","Difference":"-0.02"},
{"Region":"C","Month":"1","Difference":"-0.05"},
{"Region":"C","Month":"2","Difference":"-0.04"},
{"Region":"C","Month":"3","Difference":"-0.03"},
{"Region":"C","Month":"4","Difference":"0"},
{"Region":"C","Month":"5","Difference":"0"},
{"Region":"C","Month":"6","Difference":"-0.02"},
{"Region":"C","Month":"7","Difference":"-0.05"},
{"Region":"C","Month":"8","Difference":"0.02"},
{"Region":"C","Month":"9","Difference":"0"},
{"Region":"C","Month":"10","Difference":"-0.03"},
{"Region":"C","Month":"11","Difference":"-0.03"},
{"Region":"C","Month":"12","Difference":"0.02"},
{"Region":"D","Month":"1","Difference":"0.05"},
{"Region":"D","Month":"2","Difference":"-0.02"},
{"Region":"D","Month":"3","Difference":"-0.05"},
{"Region":"D","Month":"4","Difference":"-0.05"},
{"Region":"D","Month":"5","Difference":"0"},
{"Region":"D","Month":"6","Difference":"-0.01"},
{"Region":"D","Month":"7","Difference":"0.02"},
{"Region":"D","Month":"8","Difference":"-0.01"},
{"Region":"D","Month":"9","Difference":"0"},
{"Region":"D","Month":"10","Difference":"-0.01"},
{"Region":"D","Month":"11","Difference":"0.01"},
{"Region":"D","Month":"12","Difference":"-0.03"}
]},
"mark": {
"type": "bar",
"stroke": "black",
"opacity": 1,
"cornerRadius": 2,
"tooltip":true
},
"width": 440,
"height": 75,
"cornerRadius": 2,
"encoding": {
"facet": {
"field": "Region",
"type": "ordinal",
"title": null,
"columns": 2
},
"x": {
"field": "Month",
"type": "ordinal",
"axis": {"labelAngle": 0}
},
"y": {
"field": "Difference",
"type": "quantitative",
"axis": {
"format": "0%",
"formatType": "pbiFormat"
}
},
"color": {
"condition": {
"test": "datum['Difference']<0",
"value": "#F78272"
},
"value": "#F2C80F"
},
"text": {
"field": "Difference",
"type": "quantitative"
}
}
}
Many thanks in advance!
*edit1: added desired output
*edit2: added dataset into the code
Desired outcome:
How's this?
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"data": {
"values": [
{"Region": "A", "Month": "1", "Difference": "-0.01"},
{"Region": "A", "Month": "2", "Difference": "0"},
{"Region": "A", "Month": "3", "Difference": "-0.03"},
{"Region": "A", "Month": "4", "Difference": "-0.01"},
{"Region": "A", "Month": "5", "Difference": "-0.01"},
{"Region": "A", "Month": "6", "Difference": "0.05"},
{"Region": "A", "Month": "7", "Difference": "-0.05"},
{"Region": "A", "Month": "8", "Difference": "-0.03"},
{"Region": "A", "Month": "9", "Difference": "0.03"},
{"Region": "A", "Month": "10", "Difference": "-0.01"},
{"Region": "A", "Month": "11", "Difference": "-0.01"},
{"Region": "A", "Month": "12", "Difference": "0.03"},
{"Region": "B", "Month": "1", "Difference": "-0.02"},
{"Region": "B", "Month": "2", "Difference": "-0.02"},
{"Region": "B", "Month": "3", "Difference": "0.02"},
{"Region": "B", "Month": "4", "Difference": "0.03"},
{"Region": "B", "Month": "5", "Difference": "-0.05"},
{"Region": "B", "Month": "6", "Difference": "-0.02"},
{"Region": "B", "Month": "7", "Difference": "-0.01"},
{"Region": "B", "Month": "8", "Difference": "0.03"},
{"Region": "B", "Month": "9", "Difference": "-0.03"},
{"Region": "B", "Month": "10", "Difference": "-0.03"},
{"Region": "B", "Month": "11", "Difference": "0.01"},
{"Region": "B", "Month": "12", "Difference": "-0.02"},
{"Region": "C", "Month": "1", "Difference": "-0.05"},
{"Region": "C", "Month": "2", "Difference": "-0.04"},
{"Region": "C", "Month": "3", "Difference": "-0.03"},
{"Region": "C", "Month": "4", "Difference": "0"},
{"Region": "C", "Month": "5", "Difference": "0"},
{"Region": "C", "Month": "6", "Difference": "-0.02"},
{"Region": "C", "Month": "7", "Difference": "-0.05"},
{"Region": "C", "Month": "8", "Difference": "0.02"},
{"Region": "C", "Month": "9", "Difference": "0"},
{"Region": "C", "Month": "10", "Difference": "-0.03"},
{"Region": "C", "Month": "11", "Difference": "-0.03"},
{"Region": "C", "Month": "12", "Difference": "0.02"},
{"Region": "D", "Month": "1", "Difference": "0.05"},
{"Region": "D", "Month": "2", "Difference": "-0.02"},
{"Region": "D", "Month": "3", "Difference": "-0.05"},
{"Region": "D", "Month": "4", "Difference": "-0.05"},
{"Region": "D", "Month": "5", "Difference": "0"},
{"Region": "D", "Month": "6", "Difference": "-0.01"},
{"Region": "D", "Month": "7", "Difference": "0.02"},
{"Region": "D", "Month": "8", "Difference": "-0.01"},
{"Region": "D", "Month": "9", "Difference": "0"},
{"Region": "D", "Month": "10", "Difference": "-0.01"},
{"Region": "D", "Month": "11", "Difference": "0.01"},
{"Region": "D", "Month": "12", "Difference": "-0.03"}
]
},
"spec": {
"width": 440,
"height": 75,
"encoding": {
"x": {"field": "Month", "type": "ordinal", "axis": {"labelAngle": 0}},
"y": {
"field": "Difference",
"type": "quantitative",
"axis": {"format": "0%", "formatType": "pbiFormat"}
},
"color": {
"condition": {"test": "datum['Difference']<0", "value": "#F78272"},
"value": "#F2C80F"
}
},
"layer": [
{
"mark": {
"type": "bar",
"stroke": "black",
"opacity": 1,
"cornerRadius": 2,
"tooltip": true
}
},
{
"mark": {
"type": "text",
"dy": {"expr": "datum.Difference < 0 ? 10 : -10"}
},
"encoding": {"text": {"field": "Difference", "type": "quantitative"}}
}
]
},
"facet": {"field": "Region", "type": "ordinal", "title": null},
"columns": 2
}
Can someone explain the behavior of the following to me?
With a base class like this:
abstract class Foo
{
string[] members;
final:
this(this T)(T child)
{
import std.conv : to;
foreach (member; __traits(derivedMembers, T))
{
mixin("members ~= to!string(child." ~ member ~ ");\r\n");
}
}
void printMembers()
{
writeln(members);
}
}
I'd expect members to be populated with the values of the passed child type.
However the behavior is really weird.
The array members will be populated infinitely, which basically will cause the program to go out of memory.
If you change the mixin to this:
mixin("if (members.length < 20) members ~= to!string(child." ~ member ~ ");\r\n");
then you'll be able to see how the array is populated, but the values do not make sense in terms of how the code should work.
Example usage:
class Bar : Foo
{
int baba;
int caca;
this() { baba = 1; caca = 2; super(this); }
}
class Baz : Foo
{
int foo;
int bar;
int baz;
this() { foo = 100; bar = 200; baz = 300; super(this); }
}
void main()
{
auto b = new Bar();
auto a = new Baz();
b.printMembers();
a.printMembers();
b.printMembers();
}
The above code will produce an output like below:
["1", "2", "1", "2", "1", "2", "1", "2", "1", "2", "1", "2", "1", "2", "1", "2", "1", "2", "1", "2", "f193.Bar", "f193.Bar", "f193.Bar", "f193.Bar", "f193.Bar", "f193.Bar", "f193.Bar", "f193.Bar", "f193.Bar"]
["100", "200", "300", "100", "200", "300", "100", "200", "300", "100", "200", "300", "100", "200", "300", "100", "200", "300", "100", "200", "f193.Baz", "f193.Baz", "f193.Baz", "f193.Baz", "f193.Baz", "f193.Baz"]
["1", "2", "1", "2", "1", "2", "1", "2", "1", "2", "1", "2", "1", "2", "1", "2", "1", "2", "1", "2", "f193.Bar", "f193.Bar", "f193.Bar", "f193.Bar", "f193.Bar", "f193.Bar", "f193.Bar", "f193.Bar", "f193.Bar"]
Where I would have expected something like:
["1", "2"]
["100", "200", "300"]
["1", "2"]
Why exactly does it behave like this? It looks like a bug to me, but maybe there's a reason for the behavior?
Looking at the code I see it's because the constructor is called recursive.
The simple fix is the following:
static if (member != "__ctor") mixin("members ~= to!string(child." ~ member ~ ");\r\n");
We are using selenium grid to all UI testcases.
We are facing issue when any variable having value 1 which is getting entered into any text field.
e.g.
set test variable ${data} 1
input text ${data}
if a variable has value set to 1 but below value is getting set:
/tmp/21fe989d-6c5d-413b-8365-cf6da42e92b9/upload957182740231871694file/1
Due to this testcases are failing as text field expectes int but it gets above value.
I am not sure from where "/tmp/21fe989d-6c5d-413b-8365-cf6da42e92b9/upload957182740231871694file/" this part is getting appended to the variable value.
This is strage as it happens only when value is 1.
Below is the detail log from test exection:
16:56:00.882 INFO Typing text '1' into text field 'xpath=//input[#name='floorValue']'
16:56:00.883 DEBUG POST http://192.168.1.201:4444/wd/hub/session/e8d83ee3-7a75-40cd-a079-bb2c83d6fb2e/elements {"using": "xpath", "sessionId": "e8d83ee3-7a75-40cd-a079-bb2c83d6fb2e", "value": "//input[#name='floorValue']"}
16:56:00.905 DEBUG Finished Request
16:56:00.905 DEBUG POST http://192.168.1.201:4444/wd/hub/session/e8d83ee3-7a75-40cd-a079-bb2c83d6fb2e/element/26/clear {"sessionId": "e8d83ee3-7a75-40cd-a079-bb2c83d6fb2e", "id": "26"}
16:56:00.931 DEBUG Finished Request
16:56:00.933 DEBUG POST http://192.168.1.201:4444/wd/hub/session/e8d83ee3-7a75-40cd-a079-bb2c83d6fb2e/file {"sessionId": "e8d83ee3-7a75-40cd-a079-bb2c83d6fb2e", "id": "26", "file": "UEsDBBQAAAAIAGJU9Uhr90YTkgoAAF5CAAABAAAAMe1bbW/bOBL+HP8Kwf5g+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kbVj+KtL4AC8XEn0N40E0/pi5PawyW1vhKVD/tN\ndy2NEzK16BcG9aeRW89yd40tl0kNWz5J3WrrZa7iM0nzmYKFte0TowpU8YVRjUeo+cMHilKhErHJ\n9xp4gRa0EGzHOx3aI9SXsoK51xsOhz3Mv8LmH6gCwN+h6wOw5Iygz1ai/jP2j4jQm4x5If8OOURp\n74Twll/ud0fejF+5/dcXd6tsdnrNkaYZTZZiug84htHdNLxB6SNKwRc0u3u/QjG4/vgSFFR3lwhG\nRP4FfAggxvDomvIXRsTQ3oN4ZczFcRBl/I1Cnrn4w+s3/+bqZ+uVRdTxHUmbZrGbZJQpwD+GYHeU\nyeStlxGTprdNZddChC8pG5+py2wdRTmGDN43DgvknInLjS2l/vBogyzoMhqOo2R+HEwGJCFH0hr/\nC1BLAQIUAxQAAAAIAGJU9Uhr90YTkgoAAF5CAAABAAAAAAAAAAAAAACkgQAAAAAxUEsFBgAAAAAB\nAAEALwAAALEKAAAAAA==\n"}
16:56:00.943 DEBUG Finished Request
16:56:00.944 DEBUG POST http://192.168.1.201:4444/wd/hub/session/e8d83ee3-7a75-40cd-a079-bb2c83d6fb2e/element/26/value {"sessionId": "e8d83ee3-7a75-40cd-a079-bb2c83d6fb2e", "id": "26", "value": ["/", "t", "m", "p", "/", "e", "8", "d", "8", "3", "e", "e", "3", "-", "7", "a", "7", "5", "-", "4", "0", "c", "d", "-", "a", "0", "7", "9", "-", "b", "b", "2", "c", "8", "3", "d", "6", "f", "b", "2", "e", "/", "u", "p", "l", "o", "a", "d", "6", "0", "5", "4", "3", "8", "4", "5", "8", "0", "2", "8", "1", "8", "0", "7", "9", "3", "f", "i", "l", "e", "/", "1"]}"