tags:

views:

351

answers:

1

I'm importing some data from MySQL into a VB.NET application with .NET charts. At the moment, the chart is plotting points by date, which means that when you zoom in, each major tick mark simply displays the date.

See http://www.oliverspencer.com/graphdemo.JPG for a picture.

It would be better to change these dates to times (hours) when one zooms in.

Preumably there's a parameter to do this, but I can't find it.

Thanks for any help.

Oliver.

A: 

The chart object contains a collection of Series, where each series holds a collection of Points (DataPointCollection). The x-axis' "plotting" type of a series can be changed at runtime, using the series' XValueType property.

I've created a simple chart with a series that has the DateTime type as its XValueType, and a button that changes the display to time-only when clicked:

Chart1.Series(0).XValueType = DataVisualization.Charting.ChartValueType.Time

and it seems to work without a hassle.

I'm not sure how you implement zooming-in, but if you can check the zoom level after it has changed - then you should have no trouble changing the XValueType conditionally.

M.A. Hanin