|
You could try this little snippet in a button click event handler to see if it works.
You must use a valid "X" value and it must be a double data type.If "X" is not valid it will give an exception.
DataPoint myDatapoint;
Double myXvalue ;
myDatapoint=chart1.Series[0].Points.FindByValue(myXvalue, "X");
MessageBox.Show(myDatapoint.YValues[0].ToString());
modified 4-Feb-19 12:40pm.
|
|
|
|
|
Y values usually go along the "Y Axis".
You could start looking under: Chart - Y Axis.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
i use the one timer in program i set 100ms intravel for that timer.every 100ms i need to increment the values and plot in chart.now my problem is the timer is got slowed when iam using the chart in my application without chart the working of timer is fine.
this is my code
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace chart
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
double a,b = 0;
private void Form1_Load(object sender, EventArgs e)
{
timer1.Start();
}
private void timer1_Tick(object sender, EventArgs e)
{
a = a + 1;
b = b + 3;
timervaluee.Text=a.ToString();
chart1.Series[0].Points.AddXY(a, b);
}
}
}
|
|
|
|
|
Mohamed Fahad wrote: chart1.Series[0].Points.AddXY(a, b);
It adds a Point to a collection every 100 ms, until the list is so large it slows down the entire application. If it could keep up with allocating new memory, you would eventually run out of it.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
i don't know how to do that there is any example for that
|
|
|
|
|
It is a logical problem; as long as the series keeps growing, the more time it requires to organize it internally and to draw it.
Have you considered removing the first point whenever adding a new one?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
May make the situation worse: List<T> - Is it really as efficient as you probably think?[^] - removing the head item requires moving all the others every time.
If the chart draw time starts to exceed the timer Tick interval you're going to have problems regardless.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
OriginalGriff wrote: If the chart draw time starts to exceed the timer Tick interval you're going to have problems regardless. Could easily be handled by looking if painting happened, and if still busy, skip updating.
Still, if it needs to move, I'd prefer drawing it myself instead of using a chart
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
I'd agree - Chart is a bit of a sledgehammer, when you need a crosshead screwdriver.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
How much did it "got slowed"?
Thread switching incurs overhead.
A timer will never go off on time unless it could predict the future.
Have you measured the length of the intervals in relation to when the timer fires?
What is the relationship between the number of ticks it takes the timer handler to execute versus the duration of the subsequent interval?
Or is there none?
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Can I use Clang in C# project to find all function calls and their argument from input text that was written in C++. how can I do that. The steps please
|
|
|
|
|
Start with a Clang tutorial, and work your way from there: clang tutorial - Google Search[^]
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I cannot decipher what that question is intended to answer.
Far as I can tell Clang has nothing to do with C#.
You can certainly use Clang just as you can any other compiler in a Visual Studio (not C#) solution/project to do custom stuff, for example creating a dll from C++ code.
But in that case the specifics of that are in the csproj file. I suppose that the project file could be mapping the C++ code files so you could look in that project and see those files. But Clang also does C and I am not sure Visual Studio is going to take to that. Might though.
Other than that I couldn't tell you how to find (list) all methods in a C# code base. I suspect there is probably a VS addin for that that. If so there might be a C++ one also and if your code base is in the project and is C++ then that would do it. If it exists.
But not sure what the point of that is. Conversely if what you want is the exposed API of the dll that is constructed by the build then there are tools that do that. Those don't care how you built it originally. So that would give you a starting point to find those in the code.
|
|
|
|
|
in fact i need just a library or tool that find function calls and their parameter. the code will be as text input. and the project will be in c# or java. so I did not know yet how to do that I need just to understand if there is anything already done like that before
|
|
|
|
|
He's trying to read C++ source code in C# and extract all the function signatures: Parser or regular expression?[^]
He thinks Clang will do it - it might - but he has no idea how to use it, or any real idea of how much work is involved in reading C++ source code ...
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
LOL - ok.
Did someone already suggest he should just build a parser (or just use one that is already out there)?
|
|
|
|
|
Oh yes. But since we didn't build it for him ...
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Thought I'd try writing a console app and run it elevated to update a json file in the Application Folder that has extreme security on the file. So far so good, but I'm trying to pass the json as it's written in the file over to the console app and it losses it's format and becomes invalid json.
At first it's a class object called rootObject. Then I serialize the class into a string that can be written directly as a file. So I'm missing something here. I figured it would be like sending json from a .Net controller to a client but I never really studied how it works. I googled it for awhile but it's all web stuff.
Any thoughts?
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
I think I got it, base64 string like an image
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
It seems liek you are trying to pass the json string on the command line when launching the console app, correct?
I'll assume that's a yes. The problem is quote marks on the command line are used to enclose arguments with spaces in them and that screws up your command line parsing.
For a requirement like this, I would not use the command line at all to pass a json file, or even use Base64 encoding to pass it either. Depending on requirements, I would start the command line app as a permanently running process for the lifetime of the app and have pass json and other commands and responses over a shared memory mapped file or named pipe.
modified 1-Feb-19 8:42am.
|
|
|
|
|
I changed the format to pass the data to Base64, but overall it was a bad idea to fix an even worst plan.
I'll move these files out of the application folder and dump this idea.
Thanks Dave!
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
I'm learning MongoDB. I'm working on a Repository<t> implementation for both MongoDB and LinqToSQL.
My MongoRepository Add method is
public override void Add(T entity)
{
var collection = GetCollection(CollectionName);
collection.InsertOne(entity);
}
This works fine. This writes out
_id:Binary('aE/9nTBrM0mkDMf6/GpSCg==')
FirstName:"John"
LastName:"Smith"
Class:"English 101"
Age:32
to the Students collection.
Then, my Get method has:
public override T Get(Guid id)
{
var collection = GetCollection(CollectionName);
var result = collection.Find(r => r.Id == id).FirstOrDefault();
return result;
}
and I call it like this
private static void GetStudent()
{
var student = _repository.Get(new Guid("aE/9nTBrM0mkDMf6/GpSCg=="));
Console.WriteLine(student);
}
The exception is "Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).'"
It seems that Mongo stores the Guid differently than in .Net. What's the right way to fix this? Not sure how to handle this.
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
CodeProject is your friend: "3 Best Practices for GUID data in MongoDB" [^]
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot
|
|
|
|
|
Kevin Marois wrote: "aE/9nTBrM0mkDMf6/GpSCg=="
That's a Base64 encoded string containing the Guid bytes, so:
new Guid(Convert.FromBase64String("aE/9nTBrM0mkDMf6/GpSCg=="))
which returns: 9dfd4f68-6b30-4933-a40c-c7fafc6a520a
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|