Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some times small values on large graph scales are not plotting #3222

Closed
SK4492 opened this issue May 22, 2023 · 11 comments
Closed

Some times small values on large graph scales are not plotting #3222

SK4492 opened this issue May 22, 2023 · 11 comments
Labels

Comments

@SK4492
Copy link

SK4492 commented May 22, 2023

Description

image
As we can see positive & negative axis values are same.
1st data point data1=10 & data2=-100 here data1 value 10 is not displaying on chart.
2nd data point data1=100 & data2=-10 here data2 values -10 is plotted on graph.

I know plotting small values on large scale graph is not possible and that is accepted behavior.
But in above case with same scale with same value one data point is visible and another is not this is misleading when we have comparison graph of data1 & data2 (i.e. comparing 100 with 10).
Is there any way to handled this.

Steps to check or reproduce

// base css
import "billboard.js/dist/theme/insight.css";
import bb from "billboard.js";

// for ESM environment, need to import modules as:
// import bb, {bar} from "billboard.js";

var chart = bb.generate({
  data: {
    columns: [
	["data1", 10, 100, 1000, 2000, 2000, 1000],
	["data2", -100, -10, -2000, -1000, -2000, -1000]
    ],
    type: "bar", // for ESM specify as: bar()
  },
  bindto: "#barChart_1"
});
@netil
Copy link
Member

netil commented May 23, 2023

Hi @SK4492, can you provide with full reproducible option?
I can't reproduce the issue with the option you provided.

@SK4492
Copy link
Author

SK4492 commented May 23, 2023

Hi @netil ,
If you remove height of the chart i.e.
const chart = bb.generate({ data: { columns: [ ["data1", 10, 100, 1000, 2000, 2000, 1000], ["data2", -100, -10, -2000, -1000, -2000, -1000] ], type: "bar" }, });

or try with Height=350
const chart = bb.generate({ size: { height: 350 }, data: { columns: [ ["data1", 10, 100, 1000, 2000, 2000, 1000], ["data2", -100, -10, -2000, -1000, -2000, -1000] ], type: "bar" }, });

image

Chart height will impact for data level display but why its different for same data value.

@netil
Copy link
Member

netil commented May 24, 2023

Tested with and without specifying size.height option, and both cases rendering 10 and -10 data values' heights were same.

From the screenshot you shared looks value 10 isn't visible, but I couldn't reproduce the issue from the below examples. Also tested on Safari and FF, they also resulted same.

@SK4492
Copy link
Author

SK4492 commented May 24, 2023

@netil, cloud you please try with below data values
["data1", 10, 100, 1000, 2000, 2000, 1000],
["data2", -100, -10, -2000, -1000, -2000, -1000]

I am able to simulate with these values ,
image
This I am seeing only for some case not for all
And in my case data1 is either 0/+ve & data2 is either 0/-ve only

And Thanks for the quick updates.

@netil
Copy link
Member

netil commented May 25, 2023

@SK4492, I already tested with the data example. Just changed the order to facilitate to point element from the browser devtool.

Here are with the data order as you pointed, but I couldn't reproduce the issue. Also tested on FF and Safari as well.

Can you try on different browser? From the source code perspective, there's no different logic for rendering positive and negative values.

@watnab
Copy link

watnab commented May 30, 2023

https://jsfiddle.net/netil/5gvbLjqc/17/


Chrome 113.0.5672.127
image

<path class="bb-shape bb-shape-0 bb-bar bb-bar-0" d="M25.53333333333333,133V132.45 H63.33333333333333 V133z" style="fill: rgb(0, 199, 60);"></path>
<path class="bb-shape bb-shape-1 bb-bar bb-bar-1" d="M190,133V133.55 H227.8 V133z" style="fill: rgb(250, 113, 113);"></path>


Firefox 113.0.2
image

<path class="bb-shape bb-shape-0 bb-bar bb-bar-0" style="fill: rgb(0, 199, 60);" d="M25.53333333333333,132V131.45416666666668 H63.33333333333333 V132z"></path>
<path class="bb-shape bb-shape-1 bb-bar bb-bar-1" style="fill: rgb(250, 113, 113);" d="M190,132V132.54583333333332 H227.8 V132z"></path>


It seems SVG rendering issue.

@netil
Copy link
Member

netil commented May 30, 2023

@watnab, thanks for the checks.

I tested on following versions(MacOS), and none of them rendered incorrectly.

  • Chrome
    • 113.0.5672.126
    • 116.0.5800.0 (canary)
  • Firefox
    • 113.0.2 
  • Safari
    • 16.4(18615.1.26.110.1)
  • Edge
    • 113.0.1774.57

What OS you're using it? @SK4492 @watnab

@watnab
Copy link

watnab commented May 30, 2023

What OS you're using it?

Windows 10 Pro
22H2
19045.2965

@netil
Copy link
Member

netil commented May 31, 2023

confirmed the issue. It's happening on windows and can be reproduced in various browsers.

@watnab
Copy link

watnab commented May 31, 2023

https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/shape-rendering

shape-rendering

Note:
As a presentation attribute,
shape-rendering can be used as a CSS property.

geometricPrecision

  • add attribute -> won't work?
    <path ... shape-rendering="geometricPrecision" />
  • set css property -> work? (but blurred?)
    path.bb-shape-0.bb-bar-0 { shape-rendering: geometricprecision; }

@netil
Copy link
Member

netil commented May 31, 2023

@SK4492 @watnab here's workaround

From the base and themes css file, every path elements applies shape-rendering:crispEdge for rendering hints.
I guess on Windows, setting crispEdge is causing this issue.

I'll be considering updating shape-rendering:crispEdge to shape-rendering:auto to prevent unexpected rendering issue.

netil pushed a commit to netil/billboard.js that referenced this issue May 31, 2023
shpe-rendering:crispEdge CSS property causing shape to not be
rendered correctly on Windows.
Remove from dist CSS files to prevent the issue.

Ref naver#3222
netil pushed a commit to netil/billboard.js that referenced this issue Jun 1, 2023
shpe-rendering:crispEdge CSS property causing shape to not be
rendered correctly on Windows.
Remove from dist CSS files to prevent the issue.

Ref naver#3222
netil pushed a commit to netil/billboard.js that referenced this issue Jun 1, 2023
shpe-rendering:crispEdge CSS property causing shape to not be
rendered correctly on Windows.
Remove from dist CSS files to prevent the issue.

Ref naver#3222
netil pushed a commit to netil/billboard.js that referenced this issue Jun 1, 2023
shpe-rendering:crispEdge CSS property causing shape to not be
rendered correctly on Windows.
Remove from dist CSS files to prevent the issue.

Ref naver#3222
netil pushed a commit to netil/billboard.js that referenced this issue Jun 1, 2023
shpe-rendering:crispEdge CSS property causing shape to not be
rendered correctly on Windows.
Remove from dist CSS files to prevent the issue.

Ref naver#3222
@netil netil closed this as completed in cf1b484 Jun 1, 2023
github-actions bot pushed a commit that referenced this issue Jun 15, 2023
# [3.9.0-next.1](3.8.2...3.9.0-next.1) (2023-06-15)

### Bug Fixes

* **export:** Fix Plugin class import ([24c0976](24c0976)), closes [#3221](#3221)
* **shape:** Fix shape rendering issue on Windows ([cf1b484](cf1b484)), closes [#3222](#3222)
* **tooltip:** Fix tooltip overflow when right side edge is hovered ([9ce900d](9ce900d)), closes [#3254](#3254)

### Features

* **arc:** Intent to ship arc.needle ([04e90aa](04e90aa)), closes [#3205](#3205)
* **data:** Intent to ship data.labels.position function ([59be3ec](59be3ec)), closes [#3237](#3237)
* **module:** Support dual CJS/ESM package ([437c007](437c007)), closes [#2202](#2202)
* **plugin:** Intent to ship TableView plugin ([215b611](215b611)), closes [#1873](#1873)
* **theme:** Intent to ship dark theme ([252a28e](252a28e)), closes [#3229](#3229)
github-actions bot pushed a commit that referenced this issue Jul 3, 2023
# [3.9.0](3.8.2...3.9.0) (2023-07-03)

### Bug Fixes

* **export:** Fix Plugin class import ([24c0976](24c0976)), closes [#3221](#3221)
* **shape:** Fix shape rendering issue on Windows ([cf1b484](cf1b484)), closes [#3222](#3222)
* **tooltip:** Fix tooltip overflow when right side edge is hovered ([9ce900d](9ce900d)), closes [#3254](#3254)

### Features

* **arc:** Intent to ship arc.needle ([04e90aa](04e90aa)), closes [#3205](#3205)
* **bar:** Intent to ship bar.front ([f7e0d80](f7e0d80)), closes [#2965](#2965)
* **data:** Intent to ship data.labels.position function ([59be3ec](59be3ec)), closes [#3237](#3237)
* **legend:** Intent to ship legend.item.interaction.dblclick ([18f5c4a](18f5c4a)), closes [#1404](#1404)
* **legend:** Intent to ship legent.item.interaction ([af87d10](af87d10)), closes [#1598](#1598)
* **point:** Enhance point.sensitivity ([a537201](a537201)), closes [#2568](#2568)
* **theme:** Intent to ship dark theme ([252a28e](252a28e)), closes [#3229](#3229)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants