Home Forums WinForms controls Xceed Chart for WinForms Deploying values using Fixed TimeScale.

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

    Hi,
    I am using a corporate licenced version of XCeed char for .net.

    The scenario which I want to deploy is –

    I get some manipulated data and timestamp through a service. I am deploying the data using LineSeries (their are multiple lines with Xvalue as timestamp). I use timescale for X Axis.

    I am following the method in given examples under Axes/Scaling/DataTimeScale.

    steps that I am doing –
    preLine.UseXValues = true;

    loop{
    preLine.Values.Add(int.Parse(keyValue.value));
    preLine.XValues.Add(keyValue.time.ToOADate());
    }

    and supose I add major ticks on X-axis using these lines of code
    DateTime beginTime = DateTime.Now;
    m_Chart.Axis(StandardAxis.PrimaryX).MajorTicks.Clear();
    for (int i = 0; i <= counter; i++)
    {
    m_Chart.Axis(StandardAxis.PrimaryX).MajorTicks.Add(beginTime.ToOADate());
    beginTime = beginTime.AddMinutes(1);
    }

    now my aim is to have these fix ticks on x axis but I get random ticks (I suppose these are taken by defualt from XValues).

    2nd issue is – my timestamps (recieved values) are separated by few seconds. But Xceed libraries use default time forma (which is HH:MM)

    m_Chart.Axis(StandardAxis.PrimaryX).ValueFormatting.Format = ValueFormat.Time;

    So values printed on X axis are – 8:12 8:12 8:12 8:13 8:13 8:14 PM. How can I show more precise values in tt:mm:ss (in fact These is the reason I want fixed values as major ticks.)

    Any quick help would be appriciated.
    Thanks in advance.

    Pankaj

    Imported from legacy forums. Posted by Pankaj (had 3295 views)

    User (Old forums)
    Member
    Post count: 23064

    First, you need to set the mode of MajorTicks to be manual, so it will take the ticks you provide form your loop.

    Second, you need to set the format of the axis label to custom, and then set the format string.

    Here is basically what you need to add to your code :

    chart.Axis( StandardAxis.PrimaryX ).ScaleMode = AxisScaleMode.DateTime;
    chart.Axis( StandardAxis.PrimaryX ).ValueFormatting.Format = ValueFormat.CustomDateTime;
    chart.Axis( StandardAxis.PrimaryX ).ValueFormatting.CustomFormat = “H:mm:ss”;
    chart.Axis( StandardAxis.PrimaryX ).StaggerTexts = true;
    chart.Axis( StandardAxis.PrimaryX ).DateTimeScale.MajorTickMode = MajorTickModeDateTime.Manual;

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

    User (Old forums)
    Member
    Post count: 23064

    Thanks Andre,
    It is working perfectly. But I could not get the seconds in the HH:MM:SS time format.
    I think it is taking default window format and I have no clue how to change it.

    Thanks once again.

    Pankaj

    Imported from legacy forums. Posted by Pankaj (had 224 views)

    User (Old forums)
    Member
    Post count: 23064

    Character case matters. That is, HH:MM:SS is not the same thing as HH:mm:ss. In fact, MM is used only for the date part (months), and mm is for the time part (minutes). If I’m not mistaken, SS is not valid, so you need to set it to ss.

    As for HH or hh (or H / h), this is the different hour format :

    HH = 09:23:00 / 16:23:00
    H = 9:23:00 / 16:23:00
    hh = 09:23:00 / 04:23:00
    h = 9:23:00 / 4:23:00

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

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