MFC Chart Drawing Axis at bottom of the graph with timestamp ( 2D data visualization class )

Posted on 2013-09-19
Medium Priority
Last Modified: 2014-01-17
I was using the graph project by Paul Barvinko available at http://www.codeproject.com/Articles/425/A-2D-data-visualisation-class
. I wanted to do two things.
I wanted to draw the x-axis at the bottom of the graph where as it is now at the top.
Also I wanted to use datetime values in the axis which is now not possible since I am not able to relate it with LOG/Pixels.
Kindly help.

Thanks in advance,
Question by:Rooh
  • 2
LVL 35

Accepted Solution

sarabande earned 1000 total points
ID: 39505617
I wanted to draw the x-axis at the bottom of the graph where as it is now at the top.
try to locate the code where the x-axis was created and where the positions were calculated. then post the code and we can help you.

Also I wanted to use datetime values in the axis which is now not possible since I am not able to relate it with LOG/Pixels.
first sort your date/time values. then write a function which calculates the timespan in hours (or minutes) from start time to each time point. you would have a little structure with two members, one for the date/time and one for the timespan. then you could do the mapping by using an array of the structure.

note, if you have the times as time_t values, the values are the seconds since 1/1/1970. so it is quite easy to calculate the spans. if the times are FILETIME it is nanoseconds and you also could easily compute differences. if they were SYSTEMTIME you could change them to FILETIME. you would use the span values instead of the time values for the graph. for the axis you would use time strings which for example could be formatted by strftime function.


Author Comment

ID: 39507959
I could only change the size of the X axis drawing. I have tried span calculation not just for date and time but also for some other dimensions. I am not able to find a ratio with the axis measurements and the quantity I use.
Please see the attached code: https://www.dropbox.com/s/vbvotz8a91loijj/test_grafix_02.zip
LVL 35

Expert Comment

ID: 39508829
in my current environment i cannot open an unknown zip file.

also EE experts can only help but not do the work for you.

can you locate the functions where the x-axis was created and drawn? if yes, post the source code in a code block of your comment.

also the functions to provide data for the chart and to make the settings for scaling and labeling the axis would be interesting.

what do you mean by 'axis measurements' ?


Featured Post

Train for your Pen Testing Engineer Certification

Enroll today in this bundle of courses to gain experience in the logistics of pen testing, Linux fundamentals, vulnerability assessments, detecting live systems, and more! This series, valued at $3,000, is free for Premium members, Team Accounts, and Qualified Experts.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

600 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question