Home Forums WinForms controls Xceed Chart for WinForms Data zoom and DataBinding with DateTime X axis

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #18767 |

    All,
    Cant’ get the chart to zoom the x axis when binding data with a date time scale on the x axis. The y axis zooms just fine. Suggestions to get the x axis to redraw with the correct max/min values from the zoom tool?

    Imported from legacy forums. Posted by jonnio (had 5499 views)

    User (Old forums)
    Member
    Post count: 23064

    There are also problems zooming with multiple y-axes, see the thread “Zooming with multiple y-axes”.

    I’ve had a long standing request for these zooming problems to be fixed. The response on earlier thread was that this would be taken up with the developers (this was several months ago.)

    Could someone please provide a status update? These are very annoying & embarrassing problems that users of my application face every day.

    Thanks in advance.

    Imported from legacy forums. Posted by JD (had 356 views)

    User (Old forums)
    Member
    Post count: 23064

    This problem was investigated internally and with the help of a sample provided by jonnio, and we could not reproduce the issue. If someone can provide use with an application reproducing the DateTime axis issue, we will do the work to fix it.

    Imported from legacy forums. Posted by André (had 416 views)

    User (Old forums)
    Member
    Post count: 23064

    I have the same problem, I made a little example that reproduce it.
    Here is all the code.

    <hr>
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    using Xceed.Chart;
    using Xceed.Chart.Core;
    using Xceed.Chart.GraphicsCore;
    using Xceed.Chart.Standard;
    using Xceed.Chart.Utilities;

    namespace xceedtest
    {
    public partial class Form1 : Form
    {
    public Form1()
    {
    InitializeComponent();
    }

    private void Form1_Load(object sender, EventArgs e)
    {
    InitChart();
    }

    private void InitChart()
    {
    DateTime from = new DateTime(2007, 05, 17, 0, 0, 0);
    DateTime to = from.AddHours(12);

    Chart m_Chart = chartControl.Charts[0];

    chartControl.Settings.RenderDevice = RenderDevice.GDI;

    Axis xAxis = m_Chart.Axis(StandardAxis.PrimaryX);
    Axis yAxis = m_Chart.Axis(StandardAxis.PrimaryY);

    xAxis.ScaleMode = AxisScaleMode.DateTime;
    yAxis.ScaleMode = AxisScaleMode.Numeric;
    xAxis.SetMajorShowAtWall(ChartWallType.Back, true);
    xAxis.SetMinorShowAtWall(ChartWallType.Back, true);
    xAxis.MinorGridLine.Pattern = LinePattern.Dot;
    xAxis.MajorGridLine.Pattern = LinePattern.Solid;
    yAxis.MajorGridLine.Pattern = LinePattern.Dot;
    //
    // Y Axis
    //
    yAxis.NumericScale.AutoLabels = false;
    yAxis.NumericScale.AutoMax = false;
    yAxis.NumericScale.AutoMin = false;
    yAxis.NumericScale.Min = 0;
    yAxis.NumericScale.Max = 9;
    yAxis.NumericScale.RoundToTickMin = true;
    yAxis.NumericScale.RoundToTickMax = true;
    yAxis.Text.Font = new Font(“arial”, 7);
    yAxis.AxisStyle = AxisStyle.Line;

    yAxis.NumericScale.MajorTickMode = MajorTickModeNumeric.CustomStep;
    yAxis.NumericScale.CustomStep = 1.0;

    for ( int i = 0; i < 10; i++ )
    {
    yAxis.Labels.Add(i.ToString());
    }
    //
    // X Axis
    //
    xAxis.DateTimeScale.MajorTickMode = MajorTickModeDateTime.CustomStep;
    xAxis.DateTimeScale.AutoMax = false;
    xAxis.DateTimeScale.AutoMin = false;
    xAxis.DateTimeScale.Min = from.ToOADate();
    xAxis.DateTimeScale.Max = to.ToOADate();
    xAxis.DateTimeScale.MinorTickCount = 2;
    xAxis.DateTimeScale.RoundToTickMin = true;
    xAxis.DateTimeScale.RoundToTickMax = true;

    xAxis.DateTimeScale.CustomStep = TimeSpan.FromHours(1);
    xAxis.ValueFormatting.Format = ValueFormat.CustomDateTime;
    xAxis.ValueFormatting.CustomFormat = “HH:mm”;

    xAxis.FillEffect.SetSolidColor(Color.White);
    xAxis.Border.Color = Color.Black;
    xAxis.InnerTickLine.Color = Color.Green;
    xAxis.OuterTickLine.Color = Color.Green;
    xAxis.Text.FillEffect.Color = Color.DarkGreen;
    xAxis.Text.Font = new Font(“arial”, 7);
    xAxis.AxisStyle = AxisStyle.Bar;

    chartControl.Refresh();
    }

    private void btnZoom_Click(object sender, EventArgs e)
    {
    DataZoomTool zoomTool = new DataZoomTool();

    chartControl.InteractivityOperations.Clear();
    chartControl.InteractivityOperations.Add(zoomTool);
    }
    }
    }
    <hr>

    Another problem that I have is when I refresh the ChartControl by any reason. The X values varies randomly from 0 to 12 some times and others from 0 to 13, even though
    xAxis.DateTimeScale.Min=0 and xAxis.DateTimeScale.Max=12.

    Greetings

    Imported from legacy forums. Posted by hernan (had 337 views)

    User (Old forums)
    Member
    Post count: 23064

    What type of series are you using?

    It would be best if you could send a working sample application that reproduces these issues to <a href=”mailto:support@xceedsoft.com”>support</a> (with necessary steps to reproduce, if there is anything special), so we can investigate this further.

    Imported from legacy forums. Posted by André (had 281 views)

    User (Old forums)
    Member
    Post count: 23064

    I’m using LineSeries, but this problem happen even without series.
    I’ll send the sample.

    Thank you

    Imported from legacy forums. Posted by hernan (had 356 views)

    User (Old forums)
    Member
    Post count: 23064

    The problem for the DateTimeScale was finally identified. It is zooming fine when using dates, the problem is when using time of day, then it does not zoom, as if the Chart is not able to handle this resolution.

    Well, it is a behavior that is due to the minHorzPageSize property on the DataZoomTool itself. This property is set to 1 by default, and this works fine when using dates on a DateTimeScale, because days are represented by a value greater than 1 (when converted to an OADate). But when using time of day, which values are less the 1, you can easily see it will not zoom.

    The solution is to simply set the minHorzPageSize to a value that will make sense for the resolution used for this scale, for example 15 minutes.

    e.g.:

    DataZoomTool zoomTool = new DataZoomTool();
    DateTime span = new DateTime( 1, 1, 1, 0, 15, 0 );
    float minHorzPageSize = System.Convert.ToSingle( span.ToOADate() );
    zoomTool.MinHorzPageSize = minHorzPageSize;
    chartControl.InteractivityOperations.Add( zoomTool );
    chartControl.Refresh();

    Imported from legacy forums. Posted by André (had 6108 views)

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.