A workaround that causes the scale to be d3js when drawing an axis with a

Source: Internet
Author: User

   /**       * Return drawing steps       * @ parameter range min to max [0,50]       * @ parameter tick count (numeric) */        getstep:function (domain, m) {            if (m = = N ull) m = ten;            var = khelpers.scaleextent (domain), span = extent[1]-extent[0], step = Math.pow (extent, Math.floor (Math.log (span/m) /math.ln10)), err = M/span * STEP;            if (Err <=.) Step *= 10; else if (Err <=.) Step *= 5; else if (Err <=.) Step *= 2;            Extent[0] = Math.ceil (extent[0]/step) * STEP;            EXTENT[1] = Math.floor (extent[1]/Step) * Step + step *. 5;            EXTENT[2] = step;            return step;        },        scaleextent:function (domain) {            var start = domain[0], stop = domain[domain.length-1];
   return Start < stop? [Start, stop]: [Stop, start];        },

The idea is to get the step, then recalculate the maximum, the minimum, and the final draw is the full scale

Reprint please specify the copyright and reprint address

A workaround that causes the scale to be d3js when drawing an axis with a

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.