Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8547913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:22:18+00:00 2026-06-11T13:22:18+00:00

To try and solve this problem, I started looking into writing a plugin for

  • 0

To try and solve this problem, I started looking into writing a plugin for flot to do what I needed. It looked surprisingly straight-forward, but I have run into a minor snag. I First used the draw hook to draw my axis (note: I’m aware this code needs some error checking to make sure the origin isn’t off the chart)

 function draw(plot, ctx) {
    var offset = plot.getPlotOffset();
    var origin = plot.pointOffset({ x: 0, y: 0 });
    ctx.moveTo(offset.left, origin.top);
    ctx.lineTo(plot.width() + offset.left, origin.top);
    ctx.stroke();
    ctx.moveTo(origin.left, offset.top);
    ctx.lineTo(origin.left, plot.height() + offset.top);
    ctx.stroke();
}

And this works, with 2 small snags. The first and most important is that for some reason it makes the very last point of my data series change color! See here:

enter image description here

The point in the upper right-hand corner has turned black. By stepping through the code I can observe that this only happens when the axes are drawn. Before my draw code is called, the point is the correct color. So I think it has something to do with the drawing on the first “stroke”. For some reason it seems to then apply the black color to the last point. Any idea on how to fix this?

The second problem is that this code is called only after flot has draw everything else (including the data points) which means that my lines appear on top of points instead of underneath them. This is only a problem for those two points that are very close to the vertical axis. Looking at the flot documentation, it mentions a drawBackground hook, but this doesn’t seem to actually exist. I tried using it and it complained the drawBackground was null. So what happened? And is there a better place to hook into and draw my axes? I want to draw after flot has worked out the size of the plot area and before it draws the first series of data points.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T13:22:20+00:00Added an answer on June 11, 2026 at 1:22 pm

    What’s currently on the website API documentation does not match the newest released version (0.7). In order to use the backgroundDraw hook, you’ll need a newer version of flot, directly from their github repository. The newest version is fine, but anything after this commit would be workable.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try to solve this problem several times and give up. Now, when I
I need to solve this problem. I started my project from the wrong concept
This started as a simple problem, but I can't solve it. I have subclassed
I have a strange problem that I could not solve. When I try to
I try to solve this question, but I have an infinite loop and don't
Hi I try solve this situation. I have WPF app with MVVM design. I
I have been trying to solve this problem for a while now and I
I realize there are several solutions to this problem. I am looking for advice
EDIT from normalocity : My answer hasn't been able to solve this problem, so
I just started C and wanted to try out a euler problem. For Euler

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.