bc... [mtk]

jquery.flot.stack.js ( File view )

  • By dxtk0812 2013-10-09
  • View(s):44
  • Download(s):0
  • Point(s): 1
			/*
Flot plugin for stacking data sets, i.e. putting them on top of each
other, for accumulative graphs.

The plugin assumes the data is sorted on x (or y if stacking
horizontally). For line charts, it is assumed that if a line has an
undefined gap (from a null point), then the line above it should have
the same gap - insert zeros instead of "null" if you want another
behaviour. This also holds for the start and end of the chart. Note
that stacking a mix of positive and negative values in most instances
doesn't make sense (so it looks weird).

Two or more series are stacked when their "stack" attribute is set to
the same key (which can be any number or string or just "true"). To
specify the default stack, you can set

  series: {

    stack: null or true or key (number/string)
  
}

or specify it for a specific series

  $.plot($("#placeholder"), [{
 data: [ ... ], stack: true 
}])
  
The stacking order is determined by the order of the data series in
the array (later series end up on top of the previous).

Internally, the plugin modifies the datapoints in each series, adding
an offset to the y value. For line series, extra data points are
inserted through interpolation. If there's a second y value, it's also
adjusted (e.g for bar charts or filled areas).
*/

(function ($) {

    var options = {

        series: {
 stack: null 
} // or number/string
    
};
    
    function init(plot) {

        function findMatchingSeries(s, allseries) {

            var res = null
            for (var i = 0; i < allseries.length; ++i) {

                if (s == allseries[i])
                    break;
                
                if (allseries[i].stack == s.stack)
                    res = allseries[i];
            
}
            
            return res;
        
}
        
        function stackData(plot, s, datapoints) {

            if (s.stack == null)
                return;

            var other = findMatchingSeries(s, plot.getData());
            if (!other)
                return;

            var ps = datapoints.pointsize,
                points = datapoints.points,
                otherps = other.datapoints.pointsize,
                otherpoints = other.datapoints.points,
                newpoints = [],
                px, py, intery, qx, qy, bottom,
                withlines = s.lines.show,
                horizontal = s.bars.horizontal,
                withbottom = ps > 2 && (horizontal ? datapoints.format[2].x : datapoints.format[2].y),
                withsteps = withlines && s.lines.steps,
                fromgap = true,
                keyOffset = horizontal ? 1 : 0,
                accumulateOffset = horizontal ? 0 : 1,
                i = 0, j = 0, l;

            while (true) {

                if (i >= points.length)
                    break;

                l = newpoints.length;

                if (points[i] == null) {

                    // copy gaps
                    for (m = 0; m < ps; ++m)
                        newpoints.push(points[i + m]);
                    i += ps;
                
}
                else if (j >= otherpoints.length) {

                    // for lines, we can't use the rest of the points
                    if (!withlines) {

                        for (m = 0; m < ps; ++m)
                            newpoints.push(points[i + m]);
                    
}
                    i += ps;
                
}
                else if (otherpoints[j] == null) {

                    // oops, got a gap
                    for (m = 0; m < ps; ++m)
                        newpoints.push(null);
                    fromgap = true;
                    j += otherps;
                
}
                else {

                    // cases where we actually got two points
                    px = points[i + keyOffset];
                    py = points[i + accumulateOffset];
                    qx = otherpoints[j + keyOffset];
                    qy = otherpoints[j + accumulateOffset];
                    bottom = 0;

                    if (px == qx) {

                        for (m = 0; m < ps; ++m)
                            newpoints.push(points[i + m]);

                        newpoints[l + accumulateOffset] += qy;
                        bottom = qy;
                        
                        i += ps;
                        j += otherps;
                    
}
                    else if (px > qx) {

                        // we got past point below, might need to
                        // insert interpolated extra point
                        if (withlines && i > 0 && points[i - ps] != null) {

                            intery = py + (points[i 
...
...
(Please download the complete source code to view)
			
...
Expand> <Close

Want complete source code? Download it here

Point(s): 1

Download
0 lines left, continue to read

File list

Tips: You can preview the content of files by clicking file names^_^
Name Size Date
01.97 kB
.htaccess232.00 B2013-08-14|09:52
README.md445.00 B2013-08-14|09:52
blank.html11.40 kB2013-08-14|09:52
calendar.html12.04 kB2013-08-14|09:52
chart.html15.03 kB2013-08-14|09:52
01.97 kB
bootstrap-cerulean.css105.84 kB2013-08-14|09:52
bootstrap-classic.css97.55 kB2013-08-14|09:52
bootstrap-classic.min.css81.03 kB2013-08-14|09:52
bootstrap-cyborg.css113.47 kB2013-08-14|09:52
bootstrap-journal.css101.30 kB2013-08-14|09:52
bootstrap-redy.css105.84 kB2013-08-14|09:52
bootstrap-responsive.css14.11 kB2013-08-14|09:52
bootstrap-responsive.min.css10.38 kB2013-08-14|09:52
bootstrap-simplex.css108.55 kB2013-08-14|09:52
bootstrap-slate.css118.87 kB2013-08-14|09:52
bootstrap-spacelab.css110.01 kB2013-08-14|09:52
bootstrap-united.css99.88 kB2013-08-14|09:52
charisma-app.css10.64 kB2013-08-14|09:52
chosen.css13.84 kB2013-08-14|09:52
colorbox.css3.22 kB2013-08-14|09:52
elfinder.min.css28.95 kB2013-08-14|09:52
elfinder.theme.css1.78 kB2013-08-14|09:52
fullcalendar.css10.45 kB2013-08-14|09:52
fullcalendar.print.css1.31 kB2013-08-14|09:52
jquery-ui-1.8.21.custom.css32.47 kB2013-08-14|09:52
jquery.cleditor.css1.36 kB2013-08-14|09:52
jquery.iphone.toggle.css3.81 kB2013-08-14|09:52
jquery.noty.css2.07 kB2013-08-14|09:52
noty_theme_default.css8.55 kB2013-08-14|09:52
opa-icons.css38.70 kB2013-08-14|09:52
uniform.default.css10.35 kB2013-08-14|09:52
uploadify.css2.48 kB2013-08-14|09:52
01.97 kB
01.97 kB
01.97 kB
html_structure.png43.52 kB2013-08-14|09:52
image_1.png5.18 kB2013-08-14|09:52
01.97 kB
documenter_style.css7.27 kB2013-08-14|09:52
01.97 kB
info.png686.00 B2013-08-14|09:52
pre_bg.png98.00 B2013-08-14|09:52
warning.png607.00 B2013-08-14|09:52
favicon.ico4.19 kB2013-08-14|09:52
index.html9.58 kB2013-08-14|09:52
01.97 kB
jquery.1.6.4.js89.52 kB2013-08-14|09:52
jquery.easing.js7.91 kB2013-08-14|09:52
jquery.scrollTo-1.4.2-min.js2.20 kB2013-08-14|09:52
script.js3.79 kB2013-08-14|09:52
error.html1.65 kB2013-08-14|09:52
file-manager.html11.75 kB2013-08-14|09:52
form.html23.81 kB2013-08-14|09:52
gallery.html17.60 kB2013-08-14|09:52
grid.html19.40 kB2013-08-14|09:52
icon.html323.15 kB2013-08-14|09:52
01.97 kB
01.97 kB
ajax-loader-1.gif723.00 B2013-08-14|09:52
ajax-loader-2.gif477.00 B2013-08-14|09:52
ajax-loader-3.gif1.05 kB2013-08-14|09:52
ajax-loader-4.gif404.00 B2013-08-14|09:52
ajax-loader-5.gif2.82 kB2013-08-14|09:52
ajax-loader-6.gif3.86 kB2013-08-14|09:52
ajax-loader-7.gif10.57 kB2013-08-14|09:52
ajax-loader-8.gif7.08 kB2013-08-14|09:52
arrows-active.png201.00 B2013-08-14|09:52
arrows-normal.png312.00 B2013-08-14|09:52
bg-input-focus.png143.00 B2013-08-14|09:52
bg-input.png143.00 B2013-08-14|09:52
border.png163.00 B2013-08-14|09:52
buttons.gif2.99 kB2013-08-14|09:52
cancel-off.png699.00 B2013-08-14|09:52
cancel-on.png715.00 B2013-08-14|09:52
chosen-sprite.png559.00 B2013-08-14|09:52
controls.png1.99 kB2013-08-14|09:52
crop.gif329.00 B2013-08-14|09:52
dialogs.png16.13 kB2013-08-14|09:52
error_bg.png137.00 B2013-08-14|09:52
favicon.ico4.19 kB2013-08-14|09:52
01.97 kB
01.97 kB
l1_MS5qcGc1344290228.png5.13 kB2013-08-14|09:52
l1_MTAuanBn1344290212.png5.20 kB2013-08-14|09:52
l1_MTEuanBn1344290212.png5.68 kB2013-08-14|09:52
l1_MTIuanBn1344290216.png5.68 kB2013-08-14|09:52
l1_MTMuanBn1344290218.png5.46 kB2013-08-14|09:52
l1_MTQuanBn1344290218.png5.60 kB2013-08-14|09:52
l1_MTUuanBn1344290220.png5.63 kB2013-08-14|09:52
l1_MTYuanBn1344290222.png5.39 kB2013-08-14|09:52
l1_MTcuanBn1344290224.png5.10 kB2013-08-14|09:52
l1_MTguanBn1344290226.png6.01 kB2013-08-14|09:52
l1_MTkuanBn1344290228.png5.91 kB2013-08-14|09:52
l1_Mi5qcGc1344290242.png5.63 kB2013-08-14|09:52
l1_MjAuanBn1344290232.png4.62 kB2013-08-14|09:52
l1_MjEuanBn1344290232.png4.59 kB2013-08-14|09:52
l1_MjIuanBn1344290236.png5.42 kB2013-08-14|09:52
l1_MjMuanBn1344290238.png5.80 kB2013-08-14|09:52
l1_MjQuanBn1344290240.png5.70 kB2013-08-14|09:52
l1_My5qcGc1344290244.png4.40 kB2013-08-14|09:52
l1_NC5qcGc1344290246.png5.61 kB2013-08-14|09:52
l1_NS5qcGc1344290246.png5.86 kB2013-08-14|09:52
l1_Ni5qcGc1344290248.png5.91 kB2013-08-14|09:52
l1_Ny5qcGc1344290252.png4.94 kB2013-08-14|09:52
l1_OC5qcGc1344290254.png5.68 kB2013-08-14|09:52
l1_OS5qcGc1344290254.png5.60 kB2013-08-14|09:52
1.jpg373.25 kB2013-08-14|09:52
10.jpg389.85 kB2013-08-14|09:52
11.jpg646.25 kB2013-08-14|09:52
12.jpg706.80 kB2013-08-14|09:52
13.jpg364.00 kB2013-08-14|09:52
14.jpg576.44 kB2013-08-14|09:52
15.jpg544.08 kB2013-08-14|09:52
16.jpg385.16 kB2013-08-14|09:52
17.jpg335.24 kB2013-08-14|09:52
18.jpg398.55 kB2013-08-14|09:52
19.jpg649.20 kB2013-08-14|09:52
2.jpg763.09 kB2013-08-14|09:52
20.jpg386.55 kB2013-08-14|09:52
21.jpg406.99 kB2013-08-14|09:52
22.jpg658.64 kB2013-08-14|09:52
23.jpg678.27 kB2013-08-14|09:52
24.jpg414.93 kB2013-08-14|09:52
3.jpg416.75 kB2013-08-14|09:52
4.jpg459.91 kB2013-08-14|09:52
5.jpg612.49 kB2013-08-14|09:52
6.jpg697.43 kB2013-08-14|09:52
7.jpg643.92 kB2013-08-14|09:52
8.jpg537.01 kB2013-08-14|09:52
9.jpg605.59 kB2013-08-14|09:52
01.97 kB
1.jpg20.25 kB2013-08-14|09:52
10.jpg19.88 kB2013-08-14|09:52
11.jpg22.11 kB2013-08-14|09:52
12.jpg15.37 kB2013-08-14|09:52
13.jpg20.36 kB2013-08-14|09:52
14.jpg21.85 kB2013-08-14|09:52
15.jpg21.72 kB2013-08-14|09:52
16.jpg20.72 kB2013-08-14|09:52
17.jpg20.24 kB2013-08-14|09:52
18.jpg21.68 kB2013-08-14|09:52
19.jpg22.03 kB2013-08-14|09:52
2.jpg16.25 kB2013-08-14|09:52
20.jpg19.71 kB2013-08-14|09:52
21.jpg19.48 kB2013-08-14|09:52
22.jpg21.04 kB2013-08-14|09:52
23.jpg21.72 kB2013-08-14|09:52
24.jpg20.97 kB2013-08-14|09:52
3.jpg19.43 kB2013-08-14|09:52
4.jpg21.63 kB2013-08-14|09:52
5.jpg22.30 kB2013-08-14|09:52
6.jpg22.23 kB2013-08-14|09:52
7.jpg19.36 kB2013-08-14|09:52
8.jpg21.65 kB2013-08-14|09:52
9.jpg21.87 kB2013-08-14|09:52
glyphicons-halflings-white.png8.57 kB2013-08-14|09:52
glyphicons-halflings.png13.50 kB2013-08-14|09:52
icons-big.png34.59 kB2013-08-14|09:52
icons-small.png7.19 kB2013-08-14|09:52
01.97 kB
off.png2.52 kB2013-08-14|09:52
on.png2.44 kB2013-08-14|09:52
slider.png1.20 kB2013-08-14|09:52
slider_center.png260.00 B2013-08-14|09:52
slider_left.png324.00 B2013-08-14|09:52
slider_right.png321.00 B2013-08-14|09:52
loading.gif9.21 kB2013-08-14|09:52
loading_background.png166.00 B2013-08-14|09:52
logo.png5.18 kB2013-08-14|09:52
logo20.png1.07 kB2013-08-14|09:52
opa-icons-black16.png27.24 kB2013-08-14|09:52
opa-icons-black32.png80.32 kB2013-08-14|09:52
opa-icons-blue16.png37.07 kB2013-08-14|09:52
opa-icons-blue32.png71.34 kB2013-08-14|09:52
opa-icons-color16.png44.21 kB2013-08-14|09:52
opa-icons-color32.png83.45 kB2013-08-14|09:52
opa-icons-darkgray16.png37.33 kB2013-08-14|09:52
opa-icons-darkgray32.png80.32 kB2013-08-14|09:52
opa-icons-gray16.png33.40 kB2013-08-14|09:52
opa-icons-gray32.png71.99 kB2013-08-14|09:52
opa-icons-green16.png39.08 kB2013-08-14|09:52
opa-icons-green32.png75.68 kB2013-08-14|09:52
opa-icons-orange16.png37.45 kB2013-08-14|09:52
opa-icons-orange32.png72.39 kB2013-08-14|09:52
opa-icons-red16.png37.41 kB2013-08-14|09:52
opa-icons-red32.png72.02 kB2013-08-14|09:52
opa-icons-white16.png20.87 kB2013-08-14|09:52
opa-icons-white32.png45.09 kB2013-08-14|09:52
progress.gif1.69 kB2013-08-14|09:52
qrcode.png1.51 kB2013-08-14|09:52
qrcode136.png10.03 kB2013-08-14|09:52
quicklook-bg.png78.00 B2013-08-14|09:52
quicklook-icons.png2.58 kB2013-08-14|09:52
resize.png101.00 B2013-08-14|09:52
spinner-mini.gif1.81 kB2013-08-14|09:52
sprite.png33.43 kB2013-08-14|09:52
star-half.png667.00 B2013-08-14|09:52
star-off.png685.00 B2013-08-14|09:52
star-on.png631.00 B2013-08-14|09:52
thumb.png7.21 kB2013-08-14|09:52
toolbar.gif68.00 B2013-08-14|09:52
toolbar.png16.76 kB2013-08-14|09:52
ui-bg_flat_0_aaaaaa_40x100.png180.00 B2013-08-14|09:52
ui-bg_flat_75_ffffff_40x100.png178.00 B2013-08-14|09:52
ui-bg_glass_55_fbf9ee_1x400.png120.00 B2013-08-14|09:52
ui-bg_glass_65_ffffff_1x400.png105.00 B2013-08-14|09:52
ui-bg_glass_75_dadada_1x400.png111.00 B2013-08-14|09:52
ui-bg_glass_75_e6e6e6_1x400.png110.00 B2013-08-14|09:52
ui-bg_glass_95_fef1ec_1x400.png119.00 B2013-08-14|09:52
ui-bg_highlight-soft_75_cccccc_1x100.png101.00 B2013-08-14|09:52
ui-icons_222222_256x240.png4.27 kB2013-08-14|09:52
ui-icons_2e83ff_256x240.png4.27 kB2013-08-14|09:52
ui-icons_454545_256x240.png4.27 kB2013-08-14|09:52
ui-icons_888888_256x240.png4.27 kB2013-08-14|09:52
ui-icons_cd0a0a_256x240.png4.27 kB2013-08-14|09:52
uploadify-cancel.png2.89 kB2013-08-14|09:52
index.html24.36 kB2013-08-14|09:52
01.97 kB
bootstrap-alert.js2.34 kB2013-08-14|09:52
bootstrap-button.js2.65 kB2013-08-14|09:52
bootstrap-carousel.js4.90 kB2013-08-14|09:52
bootstrap-collapse.js4.29 kB2013-08-14|09:52
bootstrap-dropdown.js2.66 kB2013-08-14|09:52
bootstrap-modal.js5.54 kB2013-08-14|09:52
bootstrap-popover.js2.81 kB2013-08-14|09:52
bootstrap-scrollspy.js4.27 kB2013-08-14|09:52
bootstrap-tab.js3.30 kB2013-08-14|09:52
bootstrap-toggle.js2.76 kB2013-08-14|09:52
bootstrap-tooltip.js7.49 kB2013-08-14|09:52
bootstrap-tour.js6.67 kB2013-08-14|09:52
bootstrap-transition.js1.76 kB2013-08-14|09:52
bootstrap-typeahead.js6.91 kB2013-08-14|09:52
charisma.js18.60 kB2013-08-14|09:52
excanvas.js40.80 kB2013-08-14|09:52
fullcalendar.min.js48.83 kB2013-08-14|09:52
jquery-1.7.2.min.js92.62 kB2013-08-14|09:52
jquery-ui-1.8.21.custom.min.js202.07 kB2013-08-14|09:52
jquery.autogrow-textarea.js2.09 kB2013-08-14|09:52
jquery.chosen.min.js22.40 kB2013-08-14|09:52
jquery.cleditor.min.js11.76 kB2013-08-14|09:52
jquery.colorbox.min.js9.46 kB2013-08-14|09:52
jquery.cookie.js1.90 kB2013-08-14|09:52
jquery.dataTables.min.js69.08 kB2013-08-14|09:52
jquery.elfinder.min.js130.93 kB2013-08-14|09:52
jquery.flot.min.js36.67 kB2013-08-14|09:52
jquery.flot.pie.min.js8.65 kB2013-08-14|09:52
jquery.flot.resize.min.js1.21 kB2013-08-14|09:52
jquery.flot.stack.js6.80 kB2013-08-14|09:52
jquery.history.js21.07 kB2013-08-14|09:52
jquery.iphone.toggle.js9.69 kB2013-08-14|09:52
jquery.js242.01 kB2013-08-14|09:52
jquery.noty.js8.19 kB2013-08-14|09:52
jquery.raty.min.js7.37 kB2013-08-14|09:52
jquery.uniform.min.js9.10 kB2013-08-14|09:52
jquery.uploadify-3.1.min.js45.20 kB2013-08-14|09:52
license.txt585.00 B2013-08-14|09:52
login.html6.30 kB2013-08-14|09:52
01.97 kB
check-exists.php412.00 B2013-08-14|09:52
01.97 kB
MySQLStorage.sql1.10 kB2013-08-14|09:52
connector.php2.06 kB2013-08-14|09:52
elFinder.class.php30.51 kB2013-08-14|09:52
elFinderConnector.class.php3.05 kB2013-08-14|09:52
elFinderVolumeDriver.class.php86.87 kB2013-08-14|09:52
elFinderVolumeLocalFileSystem.class.php21.82 kB2013-08-14|09:52
elFinderVolumeMySQL.class.php22.56 kB2013-08-14|09:52
mime.types13.55 kB2013-08-14|09:52
uploadify.php771.00 B2013-08-14|09:52
uploadify.swf12.38 kB2013-08-14|09:52
01.97 kB
blank.php834.00 B2013-08-14|09:52
calendar.php1.46 kB2013-08-14|09:52
chart.php4.45 kB2013-08-14|09:52
error.php1.65 kB2013-08-14|09:52
file-manager.php1.16 kB2013-08-14|09:52
footer.php4.53 kB2013-08-14|09:52
form.php13.22 kB2013-08-14|09:52
gallery.php1.42 kB2013-08-14|09:52
grid.php8.81 kB2013-08-14|09:52
header.php7.05 kB2013-08-14|09:52
icon.php312.57 kB2013-08-14|09:52
index.php13.91 kB2013-08-14|09:52
login.php1.42 kB2013-08-14|09:52
table.php36.99 kB2013-08-14|09:52
tour.php1.04 kB2013-08-14|09:52
typography.php8.34 kB2013-08-14|09:52
ui.php11.67 kB2013-08-14|09:52
table.html47.57 kB2013-08-14|09:52
tour.html11.62 kB2013-08-14|09:52
typography.html18.92 kB2013-08-14|09:52
ui.html22.97 kB2013-08-14|09:52
...

jquery.flot.stack.js (14.65 MB)

Need 1 point
Your Point(s)

Your Point isn't enough.

Get point immediately by PayPal

More(Debit card / Credit card / PayPal Credit / Online Banking)

Submit your source codes. Get more point

LOGIN

Don't have an account? Register now
Need any help?
Mail to: support@codeforge.com

切换到中文版?

CodeForge Chinese Version
CodeForge English Version

Where are you going?

^_^"Oops ...

Sorry!This guy is mysterious, its blog hasn't been opened, try another, please!
OK

Warm tip!

CodeForge to FavoriteFavorite by Ctrl+D