@cryptotaxi247 / netdata-1 / commits / 90617f2f1

support for non-interpolated dimensions for both incremental and absolute values; fixed json date and number generation for smaller length; nonzero mode now generates at least a dimension without any data to allow proper chart rendering; when exiting the memory structures are not destroied so that other threads will not crash the server

Costa Tsaousis (ktsaou) committed May 20, 2014 at 00:57 UTC 90617f2f1764ea72eb85b2f942847bab05558019
4 files changed +167 -108
apps_plugin.c
+3 -3
@@ -1048,14 +1048,14 @@ void show_charts(void)
1048 for (w = target_root; w ; w = w->next) {
1049 if(w->target || (!w->processes && !w->exposed)) continue;
1050
1051 - fprintf(stdout, "DIMENSION %s '' absolute-last-value 1 1\n", w->name);
1051 + fprintf(stdout, "DIMENSION %s '' absolute-no-interpolation 1 1\n", w->name);
1052 }
1053
1054 fprintf(stdout, "CHART apps.processes '' 'Apps Processes' 'processes' apps apps stacked 20004 %d\n", update_every);
1055 for (w = target_root; w ; w = w->next) {
1056 if(w->target || (!w->processes && !w->exposed)) continue;
1057
1058 - fprintf(stdout, "DIMENSION %s '' absolute-last-value 1 1\n", w->name);
1058 + fprintf(stdout, "DIMENSION %s '' absolute-no-interpolation 1 1\n", w->name);
1059 }
1060
1061 fprintf(stdout, "CHART apps.cpu_user '' 'Apps CPU User Time (%ld%% = %ld core%s)' 'cpu time %%' apps none stacked 20020 %d\n", (processors * 100), processors, (processors>1)?"s":"", update_every);
@@ -1119,7 +1119,7 @@ void show_charts(void)
1119 fprintf(stdout, "DIMENSION system '' incremental 1 1000\n");
1120
1121 fprintf(stdout, "CHART netdata.apps_files '' 'Apps Plugin Files' 'files/s' netdata netdata line 10001 %d\n", update_every);
1122 - fprintf(stdout, "DIMENSION files '' incremental-last-value 1 1\n");
1122 + fprintf(stdout, "DIMENSION files '' incremental-no-interpolation 1 1\n");
1123
1124 fflush(stdout);
1125 }
charts.d/squid.chart.sh
+5 -5
@@ -23,17 +23,17 @@ DIMENSION client_http_kbytes_out out incremental -8 1
23 DIMENSION client_http_hit_kbytes_out hits incremental -8 1
24
25 CHART squid.clients_requests '' "Squid Client Requests" "requests/s" squid '' line 20003 $update_every
26 -DIMENSION client_http_requests requests incremental 1 1
27 -DIMENSION client_http_hits hits incremental 1 1
28 -DIMENSION client_http_errors errors incremental -1 1
26 +DIMENSION client_http_requests requests incremental-no-interpolation 1 1
27 +DIMENSION client_http_hits hits incremental-no-interpolation 1 1
28 +DIMENSION client_http_errors errors incremental-no-interpolation -1 1
29
30 CHART squid.servers_net '' "Squid Server Bandwidth" "kilobits/s" squid '' area 20002 $update_every
31 DIMENSION server_all_kbytes_in in incremental 8 1
32 DIMENSION server_all_kbytes_out out incremental -8 1
33
34 CHART squid.servers_requests '' "Squid Server Requests" "requests/s" squid '' line 20004 $update_every
35 -DIMENSION server_all_requests requests incremental 1 1
36 -DIMENSION server_all_errors errors incremental -1 1
35 +DIMENSION server_all_requests requests incremental-no-interpolation 1 1
36 +DIMENSION server_all_errors errors incremental-no-interpolation -1 1
37 EOF
38
39 return 0
netdata.c
+148 -93
@@ -840,23 +840,28 @@ int config_set_boolean(const char *section, const char *name, int value)
840 // ----------------------------------------------------------------------------
841 // chart types
842
843 +#define CHART_TYPE_LINE_NAME "line"
844 +#define CHART_TYPE_AREA_NAME "area"
845 +#define CHART_TYPE_STACKED_NAME "stacked"
846 +
847 +
848 #define CHART_TYPE_LINE 0
849 #define CHART_TYPE_AREA 1
850 #define CHART_TYPE_STACKED 2
851
852 int chart_type_id(const char *name)
853 {
849 - if(strcmp(name, "area") == 0) return CHART_TYPE_AREA;
850 - if(strcmp(name, "stacked") == 0) return CHART_TYPE_STACKED;
851 - if(strcmp(name, "line") == 0) return CHART_TYPE_LINE;
854 + if(strcmp(name, CHART_TYPE_AREA_NAME) == 0) return CHART_TYPE_AREA;
855 + if(strcmp(name, CHART_TYPE_STACKED_NAME) == 0) return CHART_TYPE_STACKED;
856 + if(strcmp(name, CHART_TYPE_LINE_NAME) == 0) return CHART_TYPE_LINE;
857 return CHART_TYPE_LINE;
858 }
859
860 const char *chart_type_name(int chart_type)
861 {
857 - static char *line = "line";
858 - static char *area = "area";
859 - static char *stacked = "stacked";
862 + static char line[] = CHART_TYPE_LINE_NAME;
863 + static char area[] = CHART_TYPE_AREA_NAME;
864 + static char stacked[] = CHART_TYPE_STACKED_NAME;
865
866 switch(chart_type) {
867 case CHART_TYPE_LINE:
@@ -875,6 +880,14 @@ const char *chart_type_name(int chart_type)
880 // ----------------------------------------------------------------------------
881 // algorithms types
882
883 +#define RRD_DIMENSION_ABSOLUTE_NAME "absolute"
884 +#define RRD_DIMENSION_INCREMENTAL_NAME "incremental"
885 +#define RRD_DIMENSION_PCENT_OVER_DIFF_TOTAL_NAME "percentage-of-incremental-row"
886 +#define RRD_DIMENSION_PCENT_OVER_ROW_TOTAL_NAME "percentage-of-absolute-row"
887 +#define RRD_DIMENSION_INCREMENTAL_NO_INTERPOLATION_NAME "incremental-no-interpolation"
888 +#define RRD_DIMENSION_ABSOLUTE_NO_INTERPOLATION_NAME "absolute-no-interpolation"
889 +
890 +
891 #define RRD_DIMENSION_ABSOLUTE 0
892 #define RRD_DIMENSION_INCREMENTAL 1
893 #define RRD_DIMENSION_PCENT_OVER_DIFF_TOTAL 2
@@ -884,23 +897,23 @@ const char *chart_type_name(int chart_type)
897
898 int algorithm_id(const char *name)
899 {
887 - if(strcmp(name, "absolute") == 0) return RRD_DIMENSION_ABSOLUTE;
888 - if(strcmp(name, "absolute-last-value") == 0) return RRD_DIMENSION_ABSOLUTE_NO_INTERPOLATION;
889 - if(strcmp(name, "incremental") == 0) return RRD_DIMENSION_INCREMENTAL;
890 - if(strcmp(name, "incremental-last-value") == 0) return RRD_DIMENSION_INCREMENTAL_NO_INTERPOLATION;
891 - if(strcmp(name, "percentage-of-absolute-row") == 0) return RRD_DIMENSION_PCENT_OVER_ROW_TOTAL;
892 - if(strcmp(name, "percentage-of-incremental-row") == 0) return RRD_DIMENSION_PCENT_OVER_DIFF_TOTAL;
900 + if(strcmp(name, RRD_DIMENSION_ABSOLUTE_NAME) == 0) return RRD_DIMENSION_ABSOLUTE;
901 + if(strcmp(name, RRD_DIMENSION_ABSOLUTE_NO_INTERPOLATION_NAME) == 0) return RRD_DIMENSION_ABSOLUTE_NO_INTERPOLATION;
902 + if(strcmp(name, RRD_DIMENSION_INCREMENTAL_NAME) == 0) return RRD_DIMENSION_INCREMENTAL;
903 + if(strcmp(name, RRD_DIMENSION_INCREMENTAL_NO_INTERPOLATION_NAME) == 0) return RRD_DIMENSION_INCREMENTAL_NO_INTERPOLATION;
904 + if(strcmp(name, RRD_DIMENSION_PCENT_OVER_ROW_TOTAL_NAME) == 0) return RRD_DIMENSION_PCENT_OVER_ROW_TOTAL;
905 + if(strcmp(name, RRD_DIMENSION_PCENT_OVER_DIFF_TOTAL_NAME) == 0) return RRD_DIMENSION_PCENT_OVER_DIFF_TOTAL;
906 return RRD_DIMENSION_ABSOLUTE;
907 }
908
909 const char *algorithm_name(int chart_type)
910 {
898 - static char *absolute = "absolute";
899 - static char *incremental = "incremental";
900 - static char *percentage_of_absolute_row = "percentage-of-absolute-row";
901 - static char *percentage_of_incremental_row = "percentage-of-incremental-row";
902 - static char *incremental_last_value = "incremental-last-value";
903 - static char *absolute_last_value = "absolute-last-value";
911 + static char absolute[] = RRD_DIMENSION_ABSOLUTE_NAME;
912 + static char incremental[] = RRD_DIMENSION_INCREMENTAL_NAME;
913 + static char percentage_of_absolute_row[] = RRD_DIMENSION_PCENT_OVER_ROW_TOTAL_NAME;
914 + static char percentage_of_incremental_row[] = RRD_DIMENSION_PCENT_OVER_DIFF_TOTAL_NAME;
915 + static char incremental_last_value[] = RRD_DIMENSION_INCREMENTAL_NO_INTERPOLATION_NAME;
916 + static char absolute_last_value[] = RRD_DIMENSION_ABSOLUTE_NO_INTERPOLATION_NAME;
917
918 switch(chart_type) {
919 case RRD_DIMENSION_ABSOLUTE:
@@ -951,27 +964,23 @@ int memory_mode = NETDATA_MEMORY_MODE_SAVE;
964
965 const char *memory_mode_name(int id)
966 {
954 - static const char *ram = NETDATA_MEMORY_MODE_RAM_NAME;
955 - static const char *map = NETDATA_MEMORY_MODE_MAP_NAME;
956 - static const char *save = NETDATA_MEMORY_MODE_SAVE_NAME;
957 - const char *s = save;
967 + static const char ram[] = NETDATA_MEMORY_MODE_RAM_NAME;
968 + static const char map[] = NETDATA_MEMORY_MODE_MAP_NAME;
969 + static const char save[] = NETDATA_MEMORY_MODE_SAVE_NAME;
970
971 switch(id) {
972 case NETDATA_MEMORY_MODE_RAM:
961 - s = ram;
962 - ;;
973 + return ram;
974
975 case NETDATA_MEMORY_MODE_MAP:
965 - s = map;
966 - ;;
976 + return map;
977
978 case NETDATA_MEMORY_MODE_SAVE:
979 default:
970 - s = save;
971 - ;;
980 + return save;
981 }
982
974 - return(s);
983 + return save;
984 }
985
986 int memory_mode_id(const char *name)
@@ -1488,6 +1497,33 @@ void rrd_stats_free_all(void)
1497 pthread_rwlock_unlock(&root_rwlock);
1498 }
1499
1500 +void rrd_stats_save_all(void)
1501 +{
1502 + RRD_STATS *st;
1503 + RRD_DIMENSION *rd;
1504 +
1505 + pthread_rwlock_wrlock(&root_rwlock);
1506 + for(st = root; st ; st = st->next) {
1507 + pthread_rwlock_wrlock(&st->rwlock);
1508 +
1509 + if(st->mapped == NETDATA_MEMORY_MODE_SAVE) {
1510 + debug(D_RRD_STATS, "Saving stats '%s' to '%s'.", st->name, st->cache_file);
1511 + savememory(st->cache_file, st, st->memsize);
1512 + }
1513 +
1514 + for(rd = st->dimensions; rd ; rd = rd->next) {
1515 + if(rd->mapped == NETDATA_MEMORY_MODE_SAVE) {
1516 + debug(D_RRD_STATS, "Saving dimension '%s' to '%s'.", rd->name, rd->cache_file);
1517 + savememory(rd->cache_file, rd, rd->memsize);
1518 + }
1519 + }
1520 +
1521 + pthread_rwlock_unlock(&st->rwlock);
1522 + }
1523 + pthread_rwlock_unlock(&root_rwlock);
1524 +}
1525 +
1526 +
1527 RRD_STATS *rrd_stats_find(const char *id)
1528 {
1529 unsigned long hash = simple_hash(id);
@@ -1810,23 +1846,26 @@ unsigned long long rrd_stats_done(RRD_STATS *st)
1846 st->last_updated.tv_usec = 0;
1847
1848 for( rd = st->dimensions ; rd ; rd = rd->next ) {
1813 - calculated_number old_calculated_value = rd->calculated_value;
1849 + calculated_number new_value;
1850
1851 switch(rd->algorithm) {
1852 case RRD_DIMENSION_ABSOLUTE_NO_INTERPOLATION:
1853 case RRD_DIMENSION_INCREMENTAL_NO_INTERPOLATION:
1818 - rd->calculated_value = rd->last_calculated_value;
1854 + if(next_ut + st->update_every * 1000000ULL < now_ut)
1855 + new_value = rd->last_calculated_value;
1856 + else
1857 + new_value = rd->calculated_value;
1858 +
1859 if(st->debug)
1860 debug(D_RRD_STATS, "%s/%s: CALC2 "
1821 - CALCULATED_NUMBER_FORMAT " = " CALCULATED_NUMBER_FORMAT
1861 + CALCULATED_NUMBER_FORMAT
1862 , st->id, rd->name
1823 - , rd->calculated_value
1824 - , rd->last_calculated_value
1863 + , new_value
1864 );
1826 - ;;
1865 + break;
1866
1867 default:
1829 - rd->calculated_value = (calculated_number)
1868 + new_value = (calculated_number)
1869 ( ( (rd->calculated_value - rd->last_calculated_value)
1870 * (calculated_number)np
1871 / (calculated_number)(now_ut - last_ut)
@@ -1841,16 +1880,16 @@ unsigned long long rrd_stats_done(RRD_STATS *st)
1880 " * %llu"
1881 " / %llu) + " CALCULATED_NUMBER_FORMAT
1882 , st->id, rd->name
1844 - , rd->calculated_value
1845 - , old_calculated_value, rd->last_calculated_value
1883 + , new_value
1884 + , rd->calculated_value, rd->last_calculated_value
1885 , np
1886 , (now_ut - last_ut), rd->last_calculated_value
1887 );
1849 - ;;
1888 + break;
1889 }
1890
1891 rd->values[st->current_entry] = (storage_number)
1853 - ( rd->calculated_value
1892 + ( new_value
1893 * (calculated_number)10
1894 * (calculated_number)rd->multiplier
1895 / (calculated_number)rd->divisor
@@ -1864,20 +1903,19 @@ unsigned long long rrd_stats_done(RRD_STATS *st)
1903 " / %ld"
1904 , st->id, rd->name
1905 , st->current_entry
1867 - , rd->values[st->current_entry]
1868 - , rd->last_calculated_value
1906 + , rd->values[st->current_entry], new_value
1907 , rd->multiplier
1908 , rd->divisor
1909 );
1910
1873 - rd->last_calculated_value = rd->calculated_value;
1874 -
1875 - if(rd->algorithm == RRD_DIMENSION_ABSOLUTE_NO_INTERPOLATION || rd->algorithm == RRD_DIMENSION_ABSOLUTE_NO_INTERPOLATION) {
1876 - if(next_ut + st->update_every * 1000000ULL >= now_ut) {
1877 - //FIXME
1878 - ;
1879 - }
1911 + if((rd->algorithm == RRD_DIMENSION_ABSOLUTE_NO_INTERPOLATION || rd->algorithm == RRD_DIMENSION_ABSOLUTE_NO_INTERPOLATION)
1912 + && (next_ut + st->update_every * 1000000ULL < now_ut)) {
1913 + // there is another iteration
1914 + // do not change the anything
1915 + ;
1916 }
1917 + else
1918 + rd->last_calculated_value = rd->calculated_value = new_value;
1919 }
1920
1921 if(st->first_entry_t && st->counter >= (unsigned long long)st->entries) {
@@ -1987,17 +2025,19 @@ void web_buffer_rrd_value(struct web_buffer *wb, storage_number value)
2025 if (value < 0) *wstr++ = '-';
2026
2027 // reverse it
1990 - strreverse(str, wstr-1);
1991 -
1992 - // move the last digit
2028 wstr--;
1994 - wstr[1] = wstr[0];
2029 + strreverse(str, wstr);
2030 +
2031 + if(*wstr != '0') {
2032 + // move the last digit one byte to the right
2033 + wstr[1] = wstr[0];
2034
1996 - // put the dot
1997 - wstr[0] = '.';
2035 + // put the dot in the hole
2036 + wstr[0] = '.';
2037
1999 - // terminate it
2000 - wstr += 2;
2038 + // terminate it
2039 + wstr += 2;
2040 + }
2041 *wstr='\0';
2042
2043 // update the buffer length
@@ -2015,39 +2055,40 @@ void web_buffer_jsdate(struct web_buffer *wb, int year, int month, int day, int
2055
2056 char *b = &wb->buffer[wb->bytes];
2057
2018 - b[0]='D';
2019 - b[1]='a';
2020 - b[2]='t';
2021 - b[3]='e';
2022 - b[4]='(';
2023 - b[5]= 48 + year / 1000; year -= (year / 1000) * 1000;
2024 - b[6]= 48 + year / 100; year -= (year / 100) * 100;
2025 - b[7]= 48 + year / 10;
2026 - b[8]= 48 + year % 10;
2027 - b[9]=',';
2028 - b[10]=' ';
2029 - b[11]= 48 + month / 10;
2030 - b[12]= 48 + month % 10;
2031 - b[13]=',';
2032 - b[14]=' ';
2033 - b[15]= 48 + day / 10;
2034 - b[16]= 48 + day % 10;
2035 - b[17]=',';
2036 - b[18]=' ';
2037 - b[19]= 48 + hours / 10;
2038 - b[20]= 48 + hours % 10;
2039 - b[21]=',';
2040 - b[22]=' ';
2041 - b[23]= 48 + minutes / 10;
2042 - b[24]= 48 + minutes % 10;
2043 - b[25]=',';
2044 - b[26]=' ';
2045 - b[27]= 48 + seconds / 10;
2046 - b[28]= 48 + seconds % 10;
2047 - b[29]=')';
2048 - b[30]='\0';
2049 -
2050 - wb->bytes += 30;
2058 + int i = 0;
2059 + b[i++]='D';
2060 + b[i++]='a';
2061 + b[i++]='t';
2062 + b[i++]='e';
2063 + b[i++]='(';
2064 + b[i++]= 48 + year / 1000; year -= (year / 1000) * 1000;
2065 + b[i++]= 48 + year / 100; year -= (year / 100) * 100;
2066 + b[i++]= 48 + year / 10;
2067 + b[i++]= 48 + year % 10;
2068 + b[i++]=',';
2069 + //b[i++]=' ';
2070 + b[i]= 48 + month / 10; if(b[i] != '0') i++;
2071 + b[i++]= 48 + month % 10;
2072 + b[i++]=',';
2073 + //b[i++]=' ';
2074 + b[i]= 48 + day / 10; if(b[i] != '0') i++;
2075 + b[i++]= 48 + day % 10;
2076 + b[i++]=',';
2077 + //b[i++]=' ';
2078 + b[i]= 48 + hours / 10; if(b[i] != '0') i++;
2079 + b[i++]= 48 + hours % 10;
2080 + b[i++]=',';
2081 + //b[i++]=' ';
2082 + b[i]= 48 + minutes / 10; if(b[i] != '0') i++;
2083 + b[i++]= 48 + minutes % 10;
2084 + b[i++]=',';
2085 + //b[i++]=' ';
2086 + b[i]= 48 + seconds / 10; if(b[i] != '0') i++;
2087 + b[i++]= 48 + seconds % 10;
2088 + b[i++]=')';
2089 + b[i]='\0';
2090 +
2091 + wb->bytes += i;
2092 }
2093
2094 struct web_buffer *web_buffer_create(long size)
@@ -2226,6 +2267,7 @@ time_t rrd_stats_first_entry_t(RRD_STATS *st)
2267
2268 unsigned long rrd_stats_one_json(RRD_STATS *st, char *options, struct web_buffer *wb)
2269 {
2270 + time_t now = time(NULL);
2271 web_buffer_increase(wb, 16384);
2272
2273 pthread_rwlock_rdlock(&st->rwlock);
@@ -2269,7 +2311,7 @@ unsigned long rrd_stats_one_json(RRD_STATS *st, char *options, struct web_buffer
2311 , rrd_stats_first_entry_t(st)
2312 , st->current_entry
2313 , st->last_updated.tv_sec
2272 - , time(NULL) - st->last_updated.tv_sec
2314 + , now - (st->last_updated.tv_sec > now) ? now : st->last_updated.tv_sec
2315 , st->update_every
2316 , st->isdetail
2317 , st->usec_since_last_update
@@ -2504,9 +2546,15 @@ unsigned long rrd_stats_json(int type, RRD_STATS *st, struct web_buffer *wb, int
2546
2547 // print the header for each dimension
2548 // and update the print_hidden array for the dimensions that should be hidden
2549 + int pc = 0;
2550 for( rd = st->dimensions, c = 0 ; rd && c < dimensions ; rd = rd->next, c++) {
2508 - if(!print_hidden[c])
2551 + if(!print_hidden[c]) {
2552 + pc++;
2553 web_buffer_printf(wb, ",\n {%sid%s:%s%s,%slabel%s:%s%s%s,%spattern%s:%s%s,%stype%s:%snumber%s}", kq, kq, sq, sq, kq, kq, sq, rd->name, sq, kq, kq, sq, sq, kq, kq, sq, sq);
2554 + }
2555 + }
2556 + if(!pc) {
2557 + web_buffer_printf(wb, ",\n {%sid%s:%s%s,%slabel%s:%s%s%s,%spattern%s:%s%s,%stype%s:%snumber%s}", kq, kq, sq, sq, kq, kq, sq, "no data", sq, kq, kq, sq, sq, kq, kq, sq, sq);
2558 }
2559
2560 // print the begin of row data
@@ -2619,8 +2667,10 @@ unsigned long rrd_stats_json(int type, RRD_STATS *st, struct web_buffer *wb, int
2667 else
2668 web_buffer_strcpy(wb, normal_annotation);
2669
2670 + pc = 0;
2671 for(c = 0 ; c < dimensions ; c++) {
2672 if(!print_hidden[c]) {
2673 + pc++;
2674 web_buffer_strcpy(wb, pre_value);
2675 web_buffer_rrd_value(wb, print_values[c]);
2676 web_buffer_strcpy(wb, post_value);
@@ -2628,6 +2678,11 @@ unsigned long rrd_stats_json(int type, RRD_STATS *st, struct web_buffer *wb, int
2678 if(print_values[c]) found_non_zero[c]++;
2679 }
2680 }
2681 + if(!pc) {
2682 + web_buffer_strcpy(wb, pre_value);
2683 + web_buffer_rrd_value(wb, (storage_number)0);
2684 + web_buffer_strcpy(wb, post_value);
2685 + }
2686
2687 printed++;
2688 }
@@ -6788,7 +6843,7 @@ void sig_handler(int signo)
6843 case SIGSEGV:
6844 error("Signaled exit (signal %d). Errno: %d (%s)", signo, errno, strerror(errno));
6845 kill_childs();
6791 - rrd_stats_free_all();
6846 + rrd_stats_save_all();
6847 exit(1);
6848 break;
6849
web/netdata.js
+11 -7
@@ -99,7 +99,7 @@ function refreshChart(chart, doNext) {
99
100 function chartIsLoadingHTML(name, width, height, message)
101 {
102 - return "<table><tr><td align=\"center\" width=\"" + width + "\" height=\"" + height + "\" style=\"vertical-align:middle\"><h4><span class=\"glyphicon glyphicon-refresh\"></span><br/><br/>loading " + name + "<br/><br/><span class=\"label label-default\">" + (message?message:"Please wait...") + "</span></h4></td></tr></table>";
102 + return "<table><tr><td align=\"center\" width=\"" + width + "\" height=\"" + height + "\" style=\"vertical-align:middle\"><h4><span class=\"glyphicon glyphicon-refresh\"></span><br/><br/>" + name + "<br/><br/><span class=\"label label-default\">" + (message?message:"loading chart...") + "</span></h4></td></tr></table>";
103 }
104
105 function showChartIsLoading(id, name, width, height, message) {
@@ -175,17 +175,17 @@ function calculateChartPointsToShow(c, divisor, maxtime, group) {
175 if(c.chartType == 'LineChart') {
176 if(c.points_to_show > c.chartOptions.width / 2) {
177 c.chartOptions.lineWidth = 1;
178 - c.chartOptions.curveType = 'line';
178 + c.chartOptions.curveType = 'none';
179 }
180
181 else if(c.points_to_show > c.chartOptions.width / 3) {
182 c.chartOptions.lineWidth = 1;
183 - c.chartOptions.curveType = 'function';
183 + c.chartOptions.curveType = c.default_curveType;
184 }
185
186 else {
187 c.chartOptions.lineWidth = 2;
188 - c.chartOptions.curveType = 'function';
188 + c.chartOptions.curveType = c.default_curveType;
189 }
190 }
191 else if(c.chartType == 'AreaChart') {
@@ -259,8 +259,6 @@ function loadCharts(base_url, doNext) {
259 json.charts[i].chartOptions.areaOpacity = 0.3;
260
261 json.charts[i].chartOptions.vAxis.viewWindowMode = 'maximized';
262 - json.charts[i].chartOptions.vAxis.minValue = null;
263 - json.charts[i].chartOptions.vAxis.maxValue = null;
262 json.charts[i].non_zero = 0;
263 break;
264
@@ -281,8 +279,14 @@ function loadCharts(base_url, doNext) {
279 case "line":
280 json.charts[i].chartType = "LineChart";
281 json.charts[i].chartOptions.lineWidth = 2;
284 - json.charts[i].chartOptions.curveType = 'function';
282 json.charts[i].non_zero = 0;
283 +
284 + json.charts[i].default_curveType = 'function';
285 + $.each(json.charts[i].dimensions, function(d, dim) {
286 + if(dim.algorithm == 'incremental-no-interpolation' || dim.algorithm == 'absolute-no-interpolation') {
287 + json.charts[i].default_curveType = 'none';
288 + }
289 + });
290 break;
291 }
292