Click here to Skip to main content
15,906,628 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionLoad txt file from resource and passing to a stream Pin
alexproject11-May-07 7:02
alexproject11-May-07 7:02 
AnswerRe: Load txt file from resource and passing to a stream Pin
Mark Salsbery11-May-07 7:43
Mark Salsbery11-May-07 7:43 
QuestionRe: Load txt file from resource and passing to a stream Pin
alexproject11-May-07 12:53
alexproject11-May-07 12:53 
AnswerRe: Load txt file from resource and passing to a stream Pin
Mark Salsbery11-May-07 13:04
Mark Salsbery11-May-07 13:04 
QuestionDisplay 2 D plot Pin
gauravsaxena_1911-May-07 6:58
gauravsaxena_1911-May-07 6:58 
AnswerRe: Display 2 D plot Pin
Cedric Moonen11-May-07 7:28
Cedric Moonen11-May-07 7:28 
GeneralRe: Display 2 D plot Pin
gauravsaxena_1914-May-07 7:24
gauravsaxena_1914-May-07 7:24 
GeneralRe: Display 2 D plot Pin
Cedric Moonen14-May-07 7:37
Cedric Moonen14-May-07 7:37 
The problem has nothing to do with the chart control but with how you use the sin and cos functions. If you use your debugger, you'll see that the values in each array are always the same. This is due to this:

X[i] = 10 * sin(i/360 * 2 * 3.141592);

If you look at my code, it is this:

X[i] = 10 * sin(i/360.0 * 2 * 3.141592);

Why does that make a difference ? Simply because when you divide two integers (i and 360), the result will always be an integer. In all cases, even if is something like 0.002 (it will be rounded to 0). If you do this: i/360.0, at least one of the operand (here the 360.0) is a float, thus the result will be a float, and you won't have an error of bounding.

(Of course, you need to do that for both the sin and the cos).

By the way, you should initialize the chart control (background, axis, title, ...) in your OnInitiDialog function, so that when you start your application, the control will look the same as when you click on the button.


Cédric Moonen
Software developer

Charting control [v1.2]

GeneralRe: Display 2 D plot Pin
gauravsaxena_1914-May-07 8:53
gauravsaxena_1914-May-07 8:53 
QuestionMouseover Pin
prathuraj11-May-07 6:35
prathuraj11-May-07 6:35 
AnswerRe: Mouseover Pin
Mark Salsbery11-May-07 7:04
Mark Salsbery11-May-07 7:04 
AnswerRe: Mouseover Pin
Nelek13-May-07 20:27
protectorNelek13-May-07 20:27 
QuestionStrange message during serialization. please help! Pin
Arris7411-May-07 6:17
Arris7411-May-07 6:17 
QuestionRe: Strange message during serialization. please help! Pin
Mark Salsbery11-May-07 6:28
Mark Salsbery11-May-07 6:28 
AnswerRe: Strange message during serialization. please help! Pin
Arris7411-May-07 8:56
Arris7411-May-07 8:56 
GeneralRe: Strange message during serialization. please help! Pin
Mark Salsbery11-May-07 9:55
Mark Salsbery11-May-07 9:55 
GeneralRe: Strange message during serialization. please help! Pin
Arris7411-May-07 10:59
Arris7411-May-07 10:59 
QuestionRe: Strange message during serialization. please help! Pin
Mark Salsbery11-May-07 11:14
Mark Salsbery11-May-07 11:14 
AnswerRe: Strange message during serialization. please help! Pin
Arris7411-May-07 11:54
Arris7411-May-07 11:54 
GeneralRe: Strange message during serialization. please help! Pin
Mark Salsbery11-May-07 12:19
Mark Salsbery11-May-07 12:19 
QuestionNo Windows xp visual styles in VC++ 2003 Pin
johnny__XP11-May-07 6:06
johnny__XP11-May-07 6:06 
AnswerRe: No Windows xp visual styles in VC++ 2003 Pin
Mark Salsbery11-May-07 6:22
Mark Salsbery11-May-07 6:22 
QuestionBreaking out of a blocking function...[Threads] Pin
Eytukan11-May-07 5:23
Eytukan11-May-07 5:23 
AnswerRe: Breaking out of a blocking function...[Threads] Pin
CPallini11-May-07 5:34
mveCPallini11-May-07 5:34 
GeneralRe: Breaking out of a blocking function...[Threads] Pin
Eytukan11-May-07 5:39
Eytukan11-May-07 5:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.