auto adjustment of chart data range

Hi. Is there any way to get calc adjust the data range of a chart automatically based on the value in a cell ? I have a routine which generates a data file in .csv format which I then copy/paste into a calc sheet to be displayed as a line chart. It all works fine - except that the .csv data file does not have a fixed number of data points. The first entry in the .csv file is the actual number of data points to be plotted, but I can’t find a way to use this value to automatically change the chart’s data range. A few searches seem to suggest that this may not be possible… any ideas ?


there is a solution for XY(Scatter)-type charts (did not test any other chart types).
(This solution does not fulfill your requirement number of data rows to be read from an input cell, which is, as far as I know, not possible)

  • Define a data range large enough to even show the largest possible number of data rows
  • Assure that all Scaling settings for x-axis are set to [x] Automatic

If you create a chart, which occupies less than the defined ranges, [x] Automatic assures to only show where you got data for.

See the following sample file: Demo-Chart-AutoShow.ods


  • Enter the number of data rows to be shown in cell D1. This value is only to calculate additional data rows and is not a value adjusting the data range for the chart in the sense of your question. It’s just to “fake” the input of data with different row numbers.
  • Additional data are calculated on-the-fly (max: 200 data rows)
  • The data range for the chart is A1:B10000 (just for demonstration purposes set that large)

Hope that helps.

The ideas presented by @anon73440385 open ways…
See ask288296FunctionChartInSectionsAfterOpaque.ods