|
Apologies for the shouting but this is important.
When answering a question please:
- Read the question carefully
- Understand that English isn't everyone's first language so be lenient of bad spelling and grammar
- If a question is poorly phrased then either ask for clarification, ignore it, or mark it down. Insults are not welcome
- If the question is inappropriate then click the 'vote to remove message' button
Insults, slap-downs and sarcasm aren't welcome. Let's work to help developers, not make them feel stupid..
cheers,
Chris Maunder
The Code Project Co-founder
Microsoft C++ MVP
|
|
|
|
|
For those new to message boards please try to follow a few simple rules when posting your question.- Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
- Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
- Keep the subject line brief, but descriptive. eg "File Serialization problem"
- Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
- Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
- Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
- If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode "<" (and other HTML) characters when pasting" checkbox before pasting anything inside the PRE block, and make sure "Use HTML in this post" check box is checked.
- Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
- Please do not post links to your question into an unrelated forum such as the lounge. It will be deleted. Likewise, do not post the same question in more than one forum.
- Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
- If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
- No advertising or soliciting.
- We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.
cheers,
Chris Maunder
The Code Project Co-founder
Microsoft C++ MVP
|
|
|
|
|
Hi,
I am developing a Work Load Analysis platform and there I use System.Windows.Forms.DataVisualization.Charting. The problem i have is, Xaxis is not updated when switching between different value types in runtime.
Here is the code, which i use to update chart from DateTime valuetype to int.
Here _EndWeek and _StartWeek are integer parameters pass to this method.
List<int> _Weeks = new List<int>();
int _Week_Difference = _EndWeek - _StartWeek;
for (int i = 0; i <= _Week_Difference; i++)
{
_Weeks.Add(_StartWeek+ i);
}
chart_Utilization.Series[0].Points.Clear();
chart_Utilization.Series[1].Points.Clear();
chart_Utilization.Series[2].Points.Clear();
chart_Utilization.Series[0].XValueType = ChartValueType.Int32;
chart_Utilization.Series[1].XValueType = ChartValueType.Int32;
chart_Utilization.Series[2].XValueType = ChartValueType.Int32;
chart_Utilization.ChartAreas[0].AxisX.Interval = 1;
chart_Utilization.ChartAreas[0].AxisX.IntervalType = DateTimeIntervalType.Number;
chart_Utilization.ChartAreas[0].AxisX.IntervalOffsetType = DateTimeIntervalType.Number;
chart_Utilization.ChartAreas[0].AxisX.LabelStyle.Format = "{0:0}";
chart_Utilization.ChartAreas[0].AxisX.Minimum = 1;
chart_Utilization.ChartAreas[0].AxisX.Maximum = 53;
chart_Utilization.Update();
I would be glad, if some could help me in this case.
|
|
|
|
|
You cleared all your points; I don't see you adding any back in.
chart_Utilization.Series[0].Points.Clear();
chart_Utilization.Series[1].Points.Clear();
chart_Utilization.Series[2].Points.Clear();
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
The data is added in a loop after this piece of code. Data is added, but the X-Axis labelling is wrong. They are still in Datetime format.
|
|
|
|
|
The x-axis usually is "time" in a time-series. You've provided no new information.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
I want to change the XAxis Value type to Int. How can i change it in runtime?
Because, the XAxis value type is dynamically changed according to the filter inputs from the user.
|
|
|
|
|
|
 Thanks a lot for your reply. I created sample application with same code here for your reference.
This method is called when form is loaded.
private void Format_Chart()
{
ChartArea _Area = new ChartArea("Utilization");
_Area.AlignmentOrientation = AreaAlignmentOrientations.Vertical;
_Area.AlignmentStyle = AreaAlignmentStyles.All;
chart_Utilization.ChartAreas.Add(_Area);
chart_Utilization.ChartAreas["Utilization"].Position = new ElementPosition(0, 10, 100, 90);
chart_Utilization.Series.Clear();
Series _Series_Current_Utilization = new Series("Current Utilization");
_Series_Current_Utilization.ChartArea = _Area.Name;
_Series_Current_Utilization.XValueType = ChartValueType.Date;
_Series_Current_Utilization.YValueType = ChartValueType.Double;
_Series_Current_Utilization.YValuesPerPoint = 1;
_Series_Current_Utilization.ChartType = SeriesChartType.StackedColumn;
_Series_Current_Utilization.Color = Color.FromArgb(200, 20, 191, 154);
Series _Series_Over_Utilization = new Series("Over Utilization");
_Series_Over_Utilization.ChartArea = _Area.Name;
_Series_Over_Utilization.XValueType = ChartValueType.Date;
_Series_Over_Utilization.YValueType = ChartValueType.Double;
_Series_Over_Utilization.YValuesPerPoint = 1;
_Series_Over_Utilization.ChartType = SeriesChartType.StackedColumn;
_Series_Over_Utilization.Color = Color.Red;
Series _Series_Target_Utilization = new Series("Target Utilization");
_Series_Target_Utilization.ChartArea = _Area.Name;
_Series_Target_Utilization.XValueType = ChartValueType.Date;
_Series_Target_Utilization.YValueType = ChartValueType.Double;
_Series_Target_Utilization.YValuesPerPoint = 1;
_Series_Target_Utilization.ChartType = SeriesChartType.Line;
_Series_Target_Utilization.Color = Color.FromArgb(200, 20, 191, 154);
chart_Utilization.Series.Add(_Series_Current_Utilization);
chart_Utilization.Series.Add(_Series_Over_Utilization);
chart_Utilization.Series.Add(_Series_Target_Utilization);
chart_Utilization.Legends[_Series_Current_Utilization.Legend].Docking = Docking.Top;
chart_Utilization.Legends[_Series_Current_Utilization.Legend].Alignment = StringAlignment.Center;
chart_Utilization.Legends[_Series_Target_Utilization.Legend].Docking = Docking.Top;
chart_Utilization.Legends[_Series_Target_Utilization.Legend].Alignment = StringAlignment.Center;
chart_Utilization.Legends[_Series_Over_Utilization.Legend].Docking = Docking.Top;
chart_Utilization.Legends[_Series_Over_Utilization.Legend].Alignment = StringAlignment.Center;
chart_Utilization.ChartAreas[0].AxisX.LabelStyle.Format = "yyyy-MM-dd";
chart_Utilization.ChartAreas[0].AxisX.Interval = 1;
chart_Utilization.ChartAreas[0].AxisX.IntervalType = DateTimeIntervalType.Days;
chart_Utilization.ChartAreas[0].AxisX.IntervalOffset = 1;
chart_Utilization.ChartAreas[0].AxisY.Maximum = (double)(120);
chart_Utilization.ChartAreas[0].AxisY.Minimum = (double)(0);
}
There are two button click events to change the value type of XAxis.
1. To change to ChartValueType.Date
private void btnDates_Click(object sender, EventArgs e)
{
List<double> _Values = new List<double>();
int _Count = 1;
for(int i = 0; i < 10; i++)
{
_Values.Add(i * 2.5d);
}
chart_Utilization.Series["Current Utilization"].Points.Clear();
chart_Utilization.Series["Over Utilization"].Points.Clear();
chart_Utilization.Series["Target Utilization"].Points.Clear();
chart_Utilization.Series["Current Utilization"].XValueType = ChartValueType.Date;
chart_Utilization.Series["Over Utilization"].XValueType = ChartValueType.Date;
chart_Utilization.Series["Target Utilization"].XValueType = ChartValueType.Date;
chart_Utilization.ChartAreas[0].AxisX.Interval = 1;
chart_Utilization.ChartAreas[0].AxisX.IntervalType = DateTimeIntervalType.Days;
chart_Utilization.ChartAreas[0].AxisX.IntervalOffset = 1;
foreach(double _dval in _Values)
{
var _point_current = new DataPoint(chart_Utilization.Series["Current Utilization"]);
var _point_target = new DataPoint(chart_Utilization.Series["Target Utilization"]);
var _point_over = new DataPoint(chart_Utilization.Series["Over Utilization"]);
_point_current.SetValueXY(new DateTime(DateTime.Now.Year, DateTime.Now.Month, _Count), _dval);
_point_target.SetValueXY(new DateTime(DateTime.Now.Year, DateTime.Now.Month, _Count), _dval);
_point_over.SetValueXY(new DateTime(DateTime.Now.Year, DateTime.Now.Month, _Count), _dval);
chart_Utilization.Series["Current Utilization"].Points.Add(_point_current);
chart_Utilization.Series["Target Utilization"].Points.Add(_point_target);
chart_Utilization.Series["Over Utilization"].Points.Add(_point_over);
_Count++;
}
}
2. To change to ChartValue type to Int
private void btnInt_Click(object sender, EventArgs e)
{
List<double> _Values = new List<double>();
int _Count = 1;
for (int i = 0; i < 10; i++)
{
_Values.Add(i * 5d);
}
chart_Utilization.Series[0].Points.Clear();
chart_Utilization.Series[1].Points.Clear();
chart_Utilization.Series[2].Points.Clear();
chart_Utilization.Series[0].XValueType = ChartValueType.Int32;
chart_Utilization.Series[1].XValueType = ChartValueType.Int32;
chart_Utilization.Series[2].XValueType = ChartValueType.Int32;
chart_Utilization.ChartAreas[0].AxisX.Interval = 1;
chart_Utilization.ChartAreas[0].AxisX.IntervalType = DateTimeIntervalType.NotSet;
chart_Utilization.ChartAreas[0].AxisX.IntervalOffsetType = DateTimeIntervalType.NotSet;
chart_Utilization.ChartAreas[0].AxisX.LabelStyle.Format = "{0:0}";
chart_Utilization.ChartAreas[0].AxisX.Minimum = 1;
chart_Utilization.ChartAreas[0].AxisX.Maximum = 53;
chart_Utilization.Update();
foreach (double _dval in _Values)
{
var _point_current = new DataPoint(chart_Utilization.Series["Current Utilization"]);
var _point_target = new DataPoint(chart_Utilization.Series["Target Utilization"]);
var _point_over = new DataPoint(chart_Utilization.Series["Over Utilization"]);
_point_current.SetValueXY(_Count, _dval);
_point_target.SetValueXY(_Count, _dval);
_point_over.SetValueXY(_Count, _dval);
chart_Utilization.Series["Current Utilization"].Points.AddXY(_Count, _dval);
chart_Utilization.Series["Target Utilization"].Points.AddXY(_Count, _dval);
chart_Utilization.Series["Over Utilization"].Points.AddXY(_Count, _dval);
_Count++;
}
}
When i switch from Date to Int, the XAxis labelling still apears as DateTime value type. This is my issue.
Please let me know in which way i can solve this issue.
|
|
|
|
|
I want to load an Excel file which contains my data, then create pivot table and pivot chart based on that file. Is there any library (free one) that can do this without limitation? 
|
|
|
|
|
|
How to change data by using a removable disk in C Sharp language
|
|
|
|
|
You're going to have to be a lot clearer about what your problem is: we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I have a database designed in C Sharp, and I have to modify this data via the Internet remotely. I want a way to modify the data by means of a removable disk so that the user takes the disk and inserted it into his device and then the modification is done
|
|
|
|
|
You can't do that automatically anymore - at least not without getting the user to change his settings, and that dangerous: Using AutoPlay and AutoRun in Windows 10 (Article from SamLogic)[^]
It's dangerous because it means any executable disk that's inserted will autorun, and it was disabled because of virus / trojan activity using it. Certainly, I wouldn't enable it on my systems!
So you would have to run an app on the client computer that either processes the data, or which detects a removable disk being inserted - this may help: Detecting USB Drive Removal in a C# Program[^]
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
You don't understand what I mean yet
I have a database of 500 employees
And I have another device with the same employee database that I have. I want in the event that I change the employee's data, then transfer the update to the disk and give it to the user to get the update on the data of his employees
|
|
|
|
|
So what part of that do you need help with?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I want to update the data via the removable disk
|
|
|
|
|
And what part of that is proving difficult?
Seriously, I can't read your mind - so repeating the lack of information you didn't give us in the first place doesn't help anybody!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
La base de données est dans mon appareil et je souhaite apporter des modifications au niveau de la base de données client à partir de mon appareil car je suis le seul autorisé à apporter des modifications aux données car je suis l'administrateur
Google Tranlate:
The database is in my device and I want to make changes at the customer database level from my device because I am the only one allowed to make changes to the data because I am the administrator
modified 3 days ago.
|
|
|
|
|
Veuillez utiliser l'anglais ici. J'ai traduit votre message pour vous cette fois
|
|
|
|
|
For the third time:Quote: And what part of that is proving difficult?
What have you tried?
Where are you stuck?
What help do you need?
I'm not trying to be difficult, but you aren't telling us anything!
Quote: Et quelle partie de cela s'avère difficile?
Qu'avez-vous essayé?
Où es-tu coincé?
Quelle aide avez-vous besoin?
Je n'essaye pas d'être difficile, mais tu ne nous dis rien!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
As OG said this cannot be done automatically. There should be an application that uses the database, you need to write an update process in that application to read the data from the removable drive and update the database.
In other words YOUR USER has to initiate the process somehow and you need to write the process.
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
I want an example in C Sharp
|
|
|
|
|
You keep saying "I want to update the data via the removable disk" but that doesn't make any sense because the disk itself cannot modify the data as it's not code that runs.
You can store an app on the disk and the user can launch that app, modifying a database that is also stored on that disk, but that's a severe security risk to your database and the people you describe in that database.
What you're doing seems like a really bad idea.
|
|
|
|