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

Wrong values for y axis are showed for stepped line chart with fill option on #133

Open
jsscks opened this issue Dec 4, 2015 · 3 comments
Labels

Comments

@jsscks
Copy link

jsscks commented Dec 4, 2015

Here is jquey.flot.js:

            if (!format) {
                format = [];
                // find out how to copy
                format.push({ x: true, number: true, required: true });
                format.push({ y: true, number: true, required: true });

                  if (s.bars.show || (s.lines.show && s.lines.fill)) {
                    ...
                   format.push({ y true, number: true, required: false, defaultValue: 0, autoscale: autoscale });
                    ...
            s.datapoints.pointsize = format.length;

Bars and lines with filling will have 3 points shift in datapoints.

Here is jquery.flot.tooltip.js:

    if (typeof item.series.lines !== "undefined" && item.series.lines.steps) {
        x = item.series.datapoints.points[item.dataIndex * 2];
        y = item.series.datapoints.points[item.dataIndex * 2 + 1];
        // TODO: where to find custom text in this variant?
        customText = "";
    }

Shift by 2 is forced. You should multiply on item.series.datapoints.pointsize instead of 2.

@SLOPapa
Copy link

SLOPapa commented Mar 28, 2016

Awesome! Thanks @jsscks - couldn't figure out what was going on until I saw this.

@krzysu krzysu added the useful label Mar 29, 2016
@SoundBlaster
Copy link

I have this issue too.
Cause of it is datapoints.pointsize, when it equals 3 than plugin incorrectly calc index for y value (390 & 391 lines on full script version)

@SoundBlaster
Copy link

390: var pointSize = item.series.datapoints.pointsize;
391: var idx = item.dataIndex * pointSize;
392: x = item.series.datapoints.points[idx];
393: y = item.series.datapoints.points[idx + 1];

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

4 participants