Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3280456
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:42:23+00:00 2026-05-17T19:42:23+00:00

I have successfully used the C++ example project to draw graphs from my C++

  • 0

I have successfully used the C++ example project to draw graphs from my C++ project using ZedGraph. However there is no example with Date axis for C++.

The following code is taken from the C# example found at
http://zedgraph.org/wiki/index.php?title=Tutorial:Date_Axis_Chart_Demo. Please see my comments with the text //JEM// to see where my problem is

    PointPairList list = new PointPairList();
    for ( int i=0; i<36; i++ )
    {
        double x = (double) new XDate( 1995, 5, i+11 );

        >  //JEM //This line above doesn't work in
        > C++.

        double y = Math.Sin( (double) i * Math.PI / 15.0 );
        list.Add( x, y );
    }

    ....missing code...

    // Set the XAxis to date type
    myPane.XAxis.Type = AxisType.Date;

    //JEM //This one also doesn't work even if I change it to the
    //syntax that C++ understands, that is,
    myPane->XAxis->Type = AxisType->Date;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T19:42:23+00:00Added an answer on May 17, 2026 at 7:42 pm

    Thanks Gacek.
    This is how it finally went down. Your answer was the turning point!!!

        for ( int i = 0; i < basin.DY; i++ ){
               XDate dato(1995,9,i,0,0,0); //date
               double x = (double)dato;
                //double x =  i;     
               double y =  basin.Qsim[i];     
               double y2 = basin.Qobs[i];     
                list->Add( x, y );     
                list2->Add( x, y2 );
        }
        //set the XAXis to date type
        myPane->XAxis->Type = AxisType::Date;
    

    here is the constructor for the Xdate type for c++ from sourceforge dot net documentation/html/M_ZedGraph_XDate__ctor_3.htm.
    XDate (int year, int month, int day, int hour, int minute, double second)

    I have also found a detailed example on this link http://www.c-plusplus.de/forum/viewtopic-var-t-is-186422-and-view-is-next.html
    with the following code

            /// ZedGraph Kurve //////////
    private: void CreateGraph( ZedGraphControl ^zgc )
    {
       GraphPane ^myPane = zgc->GraphPane;
    
       // Set the titles and axis labels
       myPane->Title->Text = "Gewichtskurve";
       myPane->XAxis->Title->Text = "Tag";
       myPane->YAxis->Title->Text = "Gewicht in Kg";
    
    
       // Make up some data points from the Sine function
        double x,y;
       PointPairList ^list = gcnew PointPairList();
       for ( int i=0; i<36; i++ )
       {
         x = (double) gcnew XDate( 1995, 5, i+11 );
          y = Math::Sin( (double) i * Math::PI / 15.0 );
          list->Add( x, y );
       }
    
       // Generate a blue curve with circle symbols, and "My Curve 2" in the legend
           LineItem ^myCurve = myPane->AddCurve( "Trainingskurve", list, Color::Blue,
           SymbolType::Circle );
    
           XDate ^xdatum = gcnew XDate ( 1995, 1, 1);
           xdatum->AddDays ( 1 );
    
           myPane->XAxis->Type = AxisType::Date;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a project which I have used Active Record and which I'd like
I'm trying to digitally sign a PDF file using THIS project as an example.
I have successfully used the Excel and Word addin templates in Visual studio 2008
My question concerns using aidl.exe (on a Windows system) from the command line. This
I've successfully compiled my library on Linux and Mac and used it with Java
I am trying to get ant4eclipse to work and I have used ant a
If anyone has used WT successfully with MSVC (mine is 2005), could you please
I have begun work on a personal project that may end up having some
I recently started transforming all tables from our Oracle production into models so I
I have been struggling with this for some time now scanning the net for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.