public/libraries.js
function (force) {
            var series = this,
              processedXData = series.xData, // copied during slice operation below
              processedYData = series.yData,
              dataLength = processedXData.length,
              croppedData,
              cropStart = 0,
              cropped,
              distance,
              closestPointRange,
              xAxis = series.xAxis,
              i, // loop variable
              options = series.options,
              cropThreshold = options.cropThreshold,
              activePointCount = 0,
              isCartesian = series.isCartesian,
              xExtremes,
              min,
              max;

            // If the series data or axes haven't changed, don't go through this. Return false to pass
            // the message on to override methods like in data grouping.
            if (isCartesian && !series.isDirty && !xAxis.isDirty && !series.yAxis.isDirty && !force) {
                return false;
            }

            if (xAxis) {
                xExtremes = xAxis.getExtremes(); // corrected for log axis (#3053)
                min = xExtremes.min;
                max = xExtremes.max;
            }

            // optionally filter out points outside the plot area
            if (isCartesian && series.sorted && (!cropThreshold || dataLength > cropThreshold || series.forceCrop)) {

                // it's outside current extremes
                if (processedXData[dataLength - 1] < min || processedXData[0] > max) {
                    processedXData = [];
                    processedYData = [];

                    // only crop if it's actually spilling out
                } else if (processedXData[0] < min || processedXData[dataLength - 1] > max) {
                    croppedData = this.cropData(series.xData, series.yData, min, max);
                    processedXData = croppedData.xData;
                    processedYData = croppedData.yData;
                    cropStart = croppedData.start;
                    cropped = true;
                    activePointCount = processedXData.length;
                }
            }


            // Find the closest distance between processed points
            for (i = processedXData.length - 1; i >= 0; i--) {
                distance = processedXData[i] - processedXData[i - 1];

                if (!cropped && processedXData[i] > min && processedXData[i] < max) {
                    activePointCount++;
                }

                if (distance > 0 && (closestPointRange === UNDEFINED || distance < closestPointRange)) {
                    closestPointRange = distance;

                    // Unsorted data is not supported by the line tooltip, as well as data grouping and
                    // navigation in Stock charts (#725) and width calculation of columns (#1900)
                } else if (distance < 0 && series.requireSorting) {
                    error(15);
                }
            }

            // Record the properties
            series.cropped = cropped; // undefined or true
            series.cropStart = cropStart;
            series.processedXData = processedXData;
            series.processedYData = processedYData;
            series.activePointCount = activePointCount;

            if (options.pointRange === null) { // null means auto, as for columns, candlesticks and OHLC
                series.pointRange = closestPointRange || 1;
            }
            series.closestPointRange = closestPointRange;

        }
function (force) {
            var series = this,
              processedXData = series.xData, // copied during slice operation below
              processedYData = series.yData,
              dataLength = processedXData.length,
              croppedData,
              cropStart = 0,
              cropped,
              distance,
              closestPointRange,
              xAxis = series.xAxis,
              i, // loop variable
              options = series.options,
              cropThreshold = options.cropThreshold,
              activePointCount = 0,
              isCartesian = series.isCartesian,
              xExtremes,
              min,
              max;

            // If the series data or axes haven't changed, don't go through this. Return false to pass
            // the message on to override methods like in data grouping.
            if (isCartesian && !series.isDirty && !xAxis.isDirty && !series.yAxis.isDirty && !force) {
                return false;
            }

            if (xAxis) {
                xExtremes = xAxis.getExtremes(); // corrected for log axis (#3053)
                min = xExtremes.min;
                max = xExtremes.max;
            }

            // optionally filter out points outside the plot area
            if (isCartesian && series.sorted && (!cropThreshold || dataLength > cropThreshold || series.forceCrop)) {

                // it's outside current extremes
                if (processedXData[dataLength - 1] < min || processedXData[0] > max) {
                    processedXData = [];
                    processedYData = [];

                    // only crop if it's actually spilling out
                } else if (processedXData[0] < min || processedXData[dataLength - 1] > max) {
                    croppedData = this.cropData(series.xData, series.yData, min, max);
                    processedXData = croppedData.xData;
                    processedYData = croppedData.yData;
                    cropStart = croppedData.start;
                    cropped = true;
                    activePointCount = processedXData.length;
                }
            }


            // Find the closest distance between processed points
            for (i = processedXData.length - 1; i >= 0; i--) {
                distance = processedXData[i] - processedXData[i - 1];

                if (!cropped && processedXData[i] > min && processedXData[i] < max) {
                    activePointCount++;
                }

                if (distance > 0 && (closestPointRange === UNDEFINED || distance < closestPointRange)) {
                    closestPointRange = distance;

                    // Unsorted data is not supported by the line tooltip, as well as data grouping and
                    // navigation in Stock charts (#725) and width calculation of columns (#1900)
                } else if (distance < 0 && series.requireSorting) {
                    error(15);
                }
            }

            // Record the properties
            series.cropped = cropped; // undefined or true
            series.cropStart = cropStart;
            series.processedXData = processedXData;
            series.processedYData = processedYData;
            series.activePointCount = activePointCount;

            if (options.pointRange === null) { // null means auto, as for columns, candlesticks and OHLC
                series.pointRange = closestPointRange || 1;
            }
            series.closestPointRange = closestPointRange;

        }
function ( force ) { var series = this , processedXData = series . xData , // copied during slice operation below processedYData = series . yData , dataLength = processedXData . length , croppedData , cropStart = 0 , cropped , distance , closestPointRange , xAxis = series . xAxis , i , // loop variable options = series . options , cropThreshold = options . cropThreshold , activePointCount = 0 , isCartesian = series . isCartesian , xExtremes , min , max ; // If the series data or axes haven't changed, don't go through this. Return false to pass // the message on to override methods like in data grouping. if ( isCartesian && ! series . isDirty && ! xAxis . isDirty && ! series . yAxis . isDirty && ! force ) { return false ; } if ( xAxis ) { xExtremes = xAxis . getExtremes ( ) ; // corrected for log axis (#3053) min = xExtremes . min ; max = xExtremes . max ; } // optionally filter out points outside the plot area if ( isCartesian && series . sorted && ( ! cropThreshold || dataLength > cropThreshold || series . forceCrop ) ) { // it's outside current extremes if ( processedXData [ dataLength - 1 ] < min || processedXData [ 0 ] > max ) { processedXData = [ ] ; processedYData = [ ] ; // only crop if it's actually spilling out } else if ( processedXData [ 0 ] < min || processedXData [ dataLength - 1 ] > max ) { croppedData = this . cropData ( series . xData , series . yData , min , max ) ; processedXData = croppedData . xData ; processedYData = croppedData . yData ; cropStart = croppedData . start ; cropped = true ; activePointCount = processedXData . length ; } } // Find the closest distance between processed points for ( i = processedXData . length - 1 ; i >= 0 ; i -- ) { distance = processedXData [ i ] - processedXData [ i - 1 ] ; if ( ! cropped && processedXData [ i ] > min && processedXData [ i ] < max ) { activePointCount ++ ; } if ( distance > 0 && ( closestPointRange === UNDEFINED || distance < closestPointRange ) ) { closestPointRange = distance ; // Unsorted data is not supported by the line tooltip, as well as data grouping and // navigation in Stock charts (#725) and width calculation of columns (#1900) } else if ( distance < 0 && series . requireSorting ) { error ( 15 ) ; } } // Record the properties series . cropped = cropped ; // undefined or true series . cropStart = cropStart ; series . processedXData = processedXData ; series . processedYData = processedYData ; series . activePointCount = activePointCount ; if ( options . pointRange === null ) { // null means auto, as for columns, candlesticks and OHLC series . pointRange = closestPointRange || 1 ; } series . closestPointRange = closestPointRange ; }
Process the data by cropping away unused data points if the series is longer
than the crop threshold. This saves computing time for lage series.
Process the data by cropping away unused data points if the series is longer than the crop threshold . This saves computing time for lage series .