File tree Expand file tree Collapse file tree 2 files changed +2
-22
lines changed
Expand file tree Collapse file tree 2 files changed +2
-22
lines changed Original file line number Diff line number Diff line change @@ -92,27 +92,6 @@ const config = {
9292};
9393/* </block:config> */
9494
95- // <block:utils:4>
96- function minValue (ctx ) {
97- const dataset = ctx .chart .data .datasets [0 ];
98- return dataset .data .reduce ((max , point ) => Math .min (point, max), Infinity );
99- }
100-
101- function maxValue (ctx ) {
102- const datasets = ctx .chart .data .datasets ;
103- const count = datasets[0 ].data .length ;
104- let max = 0 ;
105- for (let i = 0 ; i < count; i++ ) {
106- let sum = 0 ;
107- for (const dataset of datasets) {
108- sum += dataset .data [i];
109- }
110- max = Math .max (max, sum);
111- }
112- return max;
113- }
114- // </block:utils>
115-
11695var actions = [
11796 {
11897 name: ' Randomize' ,
Original file line number Diff line number Diff line change @@ -83,7 +83,8 @@ const config = {
8383// <block:utils:3>
8484function minValue (ctx ) {
8585 const dataset = ctx .chart .data .datasets [0 ];
86- return dataset .data .reduce ((max , point ) => Math .min (point, max), Infinity );
86+ const min = dataset .data .reduce ((max , point ) => Math .min (point, max), Infinity );
87+ return isFinite (min) ? min : 0 ;
8788}
8889
8990function maxValue (ctx ) {
You can’t perform that action at this time.
0 commit comments