swimlane / ngx-charts

:bar_chart: Declarative Charting Framework for Angular
https://swimlane.github.io/ngx-charts/
MIT License
4.3k stars 1.15k forks source link

Combo chart line dot does not stay on the middle of single bar reference #556

Open calebeaires opened 7 years ago

calebeaires commented 7 years ago

I'm submitting a ... (check one with "x")

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here

Current behavior Combo chart line dots dont take the middle of barchart single bar. If you change the way scale is calculated, it works very well

**Current ngx-charts lib

// use rangeRound
  getXScale(): any {
    this.xDomain = this.getXDomain();
    const spacing = this.xDomain.length / (this.dims.width / this.barPadding + 1);
    return scaleBand()
      .rangeRound([0, this.dims.width])
      .paddingInner(spacing)
      .domain(this.xDomain);
  }

Fix:

// use range
  getXScale(): any {
    this.xDomain = this.getXDomain();
    const spacing = this.xDomain.length / (this.dims.width / this.barPadding + 1);
    return scaleBand()
      .range([0, this.dims.width])
      .paddingInner(spacing)
      .domain(this.xDomain);
  }
marjan-georgiev commented 7 years ago

Could you submit a PR for this please?

s-inshiy commented 6 years ago

hey @marjan-georgiev we still have the problem above

Combo chart line dots dont take the middle of barchart single bar. ( Could you check it please?

s-inshiy commented 6 years ago

ngx-center

s-inshiy commented 6 years ago

also the fix from @calebeaires (rangeRound -> range) doesn't solve the problem

marjan-georgiev commented 6 years ago

@slesarevns I do not see that on the demo page:

image

s-inshiy commented 6 years ago

Just try to change the width of screen or set fixed width for bar as result you will see the issue

пн, 10 сент. 2018 г., 23:24 Marjan Georgiev notifications@github.com:

@slesarevns https://github.com/slesarevns I do not see that on the demo page:

[image: image] https://user-images.githubusercontent.com/8687/45322320-24b36280-b505-11e8-9a38-26570db78403.png

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/swimlane/ngx-charts/issues/556#issuecomment-420048117, or mute the thread https://github.com/notifications/unsubscribe-auth/AKCO8UWpILEufZVW33y-mtqwHy3PK9Ucks5uZsqNgaJpZM4PeB3N .