1

Goal

I want to display data into a chart control. Like so:

Chart

Current Problem

My issue is the data (blue line) goes out of the chart. As seen above, it seems as if my data exceeds the viewing pane... I'd like to be able to view the whole thing.

Is it possible to create some sort of padding? Keep in mind, not all values will be in percentage...

Alex
  • 4,821
  • 16
  • 65
  • 106
  • Are you using the .Net DataVisualization Charting control? – ChicagoMike May 08 '15 at 14:52
  • Have you tried setting the [AutoSize property](https://msdn.microsoft.com/en-us/library/system.windows.forms.control.autosize(v=vs.110).aspx) to true? – Eminem May 08 '15 at 14:55
  • @Eminem There is no autosize property for that. – Alex May 08 '15 at 15:09
  • @ChicagoMike I'm using the default chart control that comes with the Visual Studio 2013 package. Are they the same? – Alex May 08 '15 at 15:09
  • Yes - I just wanted to ask because different charting components have very different interactions. – ChicagoMike May 08 '15 at 15:56
  • Do you have a maximum value set for the Y value axis? – ChicagoMike May 08 '15 at 16:07
  • Also, in doing some research, [this answer](http://stackoverflow.com/questions/8788801/how-do-i-force-a-chart-to-auto-adjust-y-axis-maximum) mentions using "chart.ChartAreas(0).RecalculateAxesScale()" if the Maximum value of the y-Axis is set to AUTO – ChicagoMike May 08 '15 at 16:10
  • @ChicagoMike Yeah I have a maximum value determined since I will have two Y Axis and the scales could be different at any time. My scale could be set in percentage, celcius, amps, hertz, kilowatts etc... – Alex May 08 '15 at 17:01

1 Answers1

0

The solution I used is multiplying the YAxis maximum by 5%.

This creates a small padding over my maximum values which enables me to view it correctly. Not very elegant but it does the job for now.

Perhaps there are better answers but this worked great.

Alex
  • 4,821
  • 16
  • 65
  • 106