FVANCOP / ChartNew.js

MIT License
420 stars 142 forks source link

Bar Chart: Pixel missing at bottom left of each bar #412

Closed rwits closed 8 years ago

rwits commented 8 years ago

Hi,

Am currently migrating from chart.js to chartnew.js, and have an issue where there's a pixel missing at the bottom left corner on each bar when using chartnew which ruins the look of it.

Looking at the sample bar charts on your site they also have the same "feature", so i assume its by design. Is there any way to override this?

image

Thanks MC

FVANCOP commented 8 years ago

Hi,

I see the missing pixel on your pasted chart, but I cannot reproduce it on Firefox/IExplorer. What is your browser (and the version) ?

Samples picked up from : http://fvancop.github.io/ChartNew.js/demo_program/index.html#../Samples/animation_bar.html

canvas

Regards, François

rwits commented 8 years ago

Hi Francois,

I can reproduce it on all modern browers (ie latest versions of Edge, Firefox 43.0.4, Chrome 48.0.2564.97 etc).

I see the same on your sample charts at https://github.com/FVANCOP/ChartNew.js/wiki/070_020_Bar - its just not as noticeable on the chart you posted, but if you look at this one its more noticeable.

image

Regards Martin


From: Francois Vancoppenolle notifications@github.com Sent: 15 February 2016 10:07 To: FVANCOP/ChartNew.js Cc: Martin Curmi Subject: Re: [ChartNew.js] Bar Chart: Pixel missing at bottom left of each bar (#412)

Hi,

I see the missing pixel on your pasted chart, but I cannot reproduce it on Firefox/IExplorer. What is your browser (and the version) ?

Samples picked up from : http://fvancop.github.io/ChartNew.js/demo_program/index.html#../Samples/animation_bar.html

[canvas]https://cloud.githubusercontent.com/assets/6121933/13045488/e5ffd876-d3d3-11e5-9bb6-f2dfb2d94ce5.png

Regards, François

Reply to this email directly or view it on GitHubhttps://github.com/FVANCOP/ChartNew.js/issues/412#issuecomment-184142574.

markosko commented 8 years ago

@FVANCOP yea its true if u look very close with zoom on sample script its same, i am on chrome now probably why its harder noticeable is more transparent border than for @mmc071's graphs which have nontransparent borders but there is missing pixel for sure

FVANCOP commented 8 years ago

I found how to solve it. Will be solved this evening (Belgium hours :-) )

markosko commented 8 years ago

this should fix this for bar graph type roundRect function around line 4185, not sure if that can create something else as bug but shouldnt

function roundRect(ctx, x, y, w, h, stroke, radius,i,j,fact) {
            y=y-1;//added this line, not need but moving bottom line to axis not sure how if stroke should be on axis line or not 
            ctx.beginPath();
            ctx.setLineDash(lineStyleFn(setOptionValue(1,"STROKESTYLE",ctx,data,statData,data.datasets[i].datasetStrokeStyle,config.datasetStrokeStyle,i,j,{nullvalue : null} )));
            ctx.moveTo(x + radius, y);
            ctx.lineTo(x + w - radius, y);
            ctx.quadraticCurveTo(x + w, y, x + w, y);
            ctx.lineTo(x + w, y - h + fact*radius);
            ctx.quadraticCurveTo(x + w, y - h, x + w - fact*radius, y - h);
            ctx.lineTo(x + radius, y - h);
            ctx.quadraticCurveTo(x, y - h, x, y - h + fact*radius);
            ctx.lineTo(x, y+1);//added +1, this fix that one pixel missing
            ctx.quadraticCurveTo(x, y, x + radius, y);
            if (stroke) ctx.stroke();
            ctx.closePath();
            ctx.fill();
            ctx.setLineDash([]);
        };

i got fixes for horizontalStackedBar and horizontalBar too, stackedBar is okey, @FVANCOP so these two graphs fixes i can send u to mail, i cant send PR now :/

FVANCOP commented 8 years ago

Problem has been solved (also for HorizontalBar); Please download and try the last version.

Regards, François

@markosko : thanks but another solution has been implemented.

rwits commented 8 years ago

Have downloaded the update and its resolved the issue.

Thanks for fast turnaround on this!


From: Francois Vancoppenolle notifications@github.com Sent: 15 February 2016 19:46 To: FVANCOP/ChartNew.js Cc: Martin Curmi Subject: Re: [ChartNew.js] Bar Chart: Pixel missing at bottom left of each bar (#412)

Reopened #412https://github.com/FVANCOP/ChartNew.js/issues/412.

Reply to this email directly or view it on GitHubhttps://github.com/FVANCOP/ChartNew.js/issues/412#event-551136043.