Click here to Skip to main content
15,914,163 members
Home / Discussions / C#
   

C#

 
AnswerRe: circular slider on winform Pin
Ralf Meier11-Dec-23 3:42
mveRalf Meier11-Dec-23 3:42 
Questionwrite the C# windows form based program that allow user conversion of number system Pin
Kemal Tajudin10-Dec-23 8:13
Kemal Tajudin10-Dec-23 8:13 
AnswerRe: write the C# windows form based program that allow user conversion of number system Pin
Dave Kreskowiak10-Dec-23 15:31
mveDave Kreskowiak10-Dec-23 15:31 
AnswerRe: write the C# windows form based program that allow user conversion of number system Pin
jschell11-Dec-23 4:36
jschell11-Dec-23 4:36 
QuestionC# multi agent framework based on MS Orleans Pin
Jerome Fortias 20229-Dec-23 5:10
Jerome Fortias 20229-Dec-23 5:10 
AnswerRe: C# multi agent framework based on MS Orleans Pin
Gerry Schmitz9-Dec-23 6:37
mveGerry Schmitz9-Dec-23 6:37 
GeneralRe: C# multi agent framework based on MS Orleans Pin
Jerome Fortias 20229-Dec-23 7:59
Jerome Fortias 20229-Dec-23 7:59 
QuestionMessenger design with C# Pin
parya mardani8-Dec-23 12:05
parya mardani8-Dec-23 12:05 
AnswerRe: Messenger design with C# Pin
Dave Kreskowiak8-Dec-23 14:28
mveDave Kreskowiak8-Dec-23 14:28 
AnswerRe: Messenger design with C# Pin
Gerry Schmitz9-Dec-23 6:35
mveGerry Schmitz9-Dec-23 6:35 
Questionis there any way to get bordercolor same as candle color using ternary in the code below Pin
j k Nov20236-Dec-23 5:48
j k Nov20236-Dec-23 5:48 
AnswerRe: is there any way to get bordercolor same as candle color using ternary in the code below Pin
Gerry Schmitz9-Dec-23 6:32
mveGerry Schmitz9-Dec-23 6:32 
QuestionC# code to chart sometimes charting blank charts Pin
Iskander1234530-Nov-23 16:01
Iskander1234530-Nov-23 16:01 
AnswerRe: C# code to chart sometimes charting blank charts Pin
Ralf Meier30-Nov-23 21:12
mveRalf Meier30-Nov-23 21:12 
GeneralRe: C# code to chart sometimes charting blank charts Pin
Iskander123451-Dec-23 0:52
Iskander123451-Dec-23 0:52 
GeneralRe: C# code to chart sometimes charting blank charts Pin
Ralf Meier1-Dec-23 2:03
mveRalf Meier1-Dec-23 2:03 
GeneralRe: C# code to chart sometimes charting blank charts Pin
Iskander123451-Dec-23 4:43
Iskander123451-Dec-23 4:43 
I tried setting breakpoints, but then got an error which said something to the effect "break point won't break because some symbol isn't there". I couldn't do away with that error so I put some checks in the code itself, to make sure that the label86 was a proper integer, that there was actually data to be plotted etc, and I ran the new code. It never went to the coded error messages and still the charts were plotted blank. Is it possible the fault is somewhere in the chart settings? maybe the series become transparent or something? But why would this happen only when we use "Where" and try to plot a part of the table data?

void PlotChart()
        {
            try
            {
                // Check if label86.Text can be converted to an integer
                if (!int.TryParse(label86.Text.Trim(), out int rawDataOrder))
                {
                    MessageBox.Show("Invalid RawDataOrder value. Please enter a valid integer.", "Error PlotChart", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return; // Exit the method
                }

                using (SqlConnection connection = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\Database1.mdf;Integrated Security=True"))
                {
                    using (SqlCommand command = new SqlCommand("SELECT * FROM SerialDataNIBP WHERE RawDataOrder = @RawDataOrder", connection))
                    {
                        // Open the connection if it's not already open
                        if (connection.State != ConnectionState.Open)
                        {
                            connection.Open();
                        }

                        command.Parameters.AddWithValue("@RawDataOrder", rawDataOrder);

                        using (SqlDataReader reader = command.ExecuteReader())
                        {
                            // Check if any data is returned
                            if (!reader.HasRows)
                            {
                                MessageBox.Show("No data found for the given RawDataOrder.", "Error PlotChart", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                return; // Exit the method
                            }

                            chart1.Series.Clear();

                            Series PulseCh1 = new Series("Series11");
                            Series PressureCh1 = new Series("Series12");

                            PulseCh1.ChartType = SeriesChartType.Spline;
                            PressureCh1.ChartType = SeriesChartType.Spline;

                            PulseCh1.Color = Color.Blue;
                            PressureCh1.Color = Color.Orange;

                            while (reader.Read())
                            {
                                var id = reader.GetInt32(0);
                                var value11 = reader.GetInt32(1);
                                var value12 = reader.GetInt32(8);

                                PulseCh1.Points.AddXY(id, value11);
                                PressureCh1.Points.AddXY(id, value12);
                            }

                            chart1.Series.Add(PulseCh1);
                            chart1.Series.Add(PressureCh1);

                            chart1.Titles.Clear();
                            chart1.Titles.Add(new Title("Channel 1"));

                            // Uncomment the line below if you want to refresh the chart display
                            chart1.Update();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error PlotChart", MessageBoxButtons.OK, MessageBoxIcon.Error);

                // Log the exception or handle it based on your application's requirements
            }
        }

GeneralRe: C# code to chart sometimes charting blank charts Pin
Ralf Meier1-Dec-23 6:18
mveRalf Meier1-Dec-23 6:18 
SuggestionRe: C# code to chart sometimes charting blank charts Pin
Richard Deeming30-Nov-23 21:56
mveRichard Deeming30-Nov-23 21:56 
AnswerRe: C# code to chart sometimes charting blank charts Pin
Richard MacCutchan30-Nov-23 22:15
mveRichard MacCutchan30-Nov-23 22:15 
GeneralRe: C# code to chart sometimes charting blank charts Pin
Iskander123451-Dec-23 0:23
Iskander123451-Dec-23 0:23 
GeneralRe: C# code to chart sometimes charting blank charts Pin
Richard MacCutchan1-Dec-23 2:06
mveRichard MacCutchan1-Dec-23 2:06 
AnswerRe: C# code to chart sometimes charting blank charts Pin
Dave Kreskowiak1-Dec-23 5:02
mveDave Kreskowiak1-Dec-23 5:02 
GeneralRe: C# code to chart sometimes charting blank charts Pin
Andre Oosthuizen1-Dec-23 22:30
mveAndre Oosthuizen1-Dec-23 22:30 
AnswerRe: C# code to chart sometimes charting blank charts Pin
jschell1-Dec-23 6:35
jschell1-Dec-23 6:35 

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.