0

I need set suggested minimum for my time series chart. It means, when I have values bigger than suggested minimum chart will be dynamically expose range until lowest value hit suggested minimum and values with lower date will not showed anymore.

var chart = new Chart(ctx, {
            type: 'line',
            data: {datasets: [ds1]},
            options: {
                scales: {
                    xAxes: [{
                        type: 'time',
                        time: {
                            unit: 'day',
                            suggestedMin: min, // this doesn't work
                            displayFormats: {
                                day: 'DD-MM-YYYY'
                            }
                        }
                    }]
                }
            }
        });

In my chart option suggestedMin doesn't work, just when I set option min instead suggestedMin work. But in this case I have a large free space in chart. I need fit chart values for whole space if its value is't before my entered suggestedMin.

whole example is here: https://jsfiddle.net/b7k2voza/1/

Can you tell me please how to do that? Thank you in advice.

Denis Stephanov
  • 4,563
  • 24
  • 78
  • 174
  • For `dataSample1`, if you only want to see values for the last 4 days, then why not just filter all the values you want before using the data to create the chart? Is that what you want? – ViqMontana Dec 11 '18 at 13:15
  • but what if these values in array will be up 5000? After every change when I will be adding new data I have to filter it. I think it isn't optimal solution. What do you think? – Denis Stephanov Dec 11 '18 at 13:30

0 Answers0