Forum Discussion
Possible Bug in d3.scaling | EDIT: How to void grouping/categorizing data
Hi there,
Ive just created two simple y and x-axes
The x-axis works fine in both, powerbi online and desktop version.
But if you take a look to the y-axis, the scaling fails however in power bi desktop. And this is something i dont understand why because i didnt do anything much different than for the x-axis.
To create the domains im using the min/max-functions from the d3 library.
Possible bug?
For any solution i would be very thankful!
This is expected behavior as Power BI aggregates the same values by using an algorithm such as Sum, Count, etc.
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals
5 Replies
- az2451Resolver I
UPDATE:
Ok there has to be something wrong with d3.max
Because if i change from d3.max to d3.median, it shows me 16 on both (online and desktop), which is correct.
That means it actually has access to all values in the array.
So can it be a bug?
I also used map, but still, the max value in desktop-version shows 9...
.domain([0, d3.max(viewModel.dataPoints.map (function (d) { return <number>d.anzahlKostenstellen; }))]);- az2451Resolver I
UPDATE2:
The problem is not d3.max.
I tried to solve it by only using a loop and check each value if its greater than max
let max = 0;
for (let i = 0, len = 100; i < len; i++) { if (((viewModel.dataPoints.map(function (d) { return <number>d.anzahlKostenstellen; }))[i]) > max) { max = ((viewModel.dataPoints.map(function (d) { return <number>d.anzahlKostenstellen; }))[0]); } }let y = d3.scale.linear() .range([ gHeight, 0 ]) .domain([0, max]);But still i get 2 different values in powerbi desktop and online app...
From this point i really dont know why power bi is doing this. Does anybody have an idea?
- v-viigCommunity Champion
Can you confirm that anzahlKostenstellen is always a number?
What version of d3 do you?
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals