Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
70
UltraChart X Axis with SQL Stored Procedure
posted

I am attempting to recreate an application that I did without Infragistics, this time I'm using Infragistics. What I am trying to do, is show a Column chart which has the number of boards processed and the time on the X Axis. Now, this time is obtained from the SQL Stored Procedure. Right now, the chart and data-grid display great, however, the X Axis shows the "BoardProcessed" and not the time. Please see attached screen shot. The first one is what it should look like, the second, is what I am getting now.

My Current Code:

   SqlConnection connection = new SqlConnection(FactoryServerMesdbConnection.ConnectToDatabase);
            SqlCommand cmd = new SqlCommand("dbo.HourlyProductionYield", connection)
            {
                CommandType = CommandType.StoredProcedure,
                CommandText = "dbo.HourlyProductionYield",
                Connection = connection
            };
 
            //Adding values to StoredProcedure parameters.
            cmd.Parameters.AddWithValue("@StartDate", startDate);
            cmd.Parameters.AddWithValue("@Shift", shift);
            cmd.Parameters.AddWithValue("@Line", productionLine);
            cmd.Parameters.AddWithValue("@OperationTaskID", operationTaskId);
            connection.Open();
            SqlDataReader drDataReader = cmd.ExecuteReader();
            webDg.DataSource = drDataReader;
            webDg.DataBind();
 
 
        }
 
        //Fill datatable with data.
        public void DisplayData()
        {
            var currentDate = DateTime.Today.ToShortDateString();
 
            GetData(currentDate, 1, 1, 100, wdgL1SMT);
            ChartData(currentDate,1,1,100, ucL1SMT);
        }
 
        public void ChartData(string startDate, int shift, int productionLine, int operationTaskId, UltraChart ucChart)
        {
            SqlConnection cdConnection = new SqlConnection(FactoryServerMesdbConnection.ConnectToDatabase);
            SqlCommand cmd = new SqlCommand("dbo.HourlyProductionYield", cdConnection)
            {
                CommandType = CommandType.StoredProcedure,
                CommandText = "dbo.HourlyProductionYield",
                Connection = cdConnection
            };
 
            //Adding values to StoredProcedure parameters.
            cmd.Parameters.AddWithValue("@StartDate", startDate);
            cmd.Parameters.AddWithValue("@Shift", shift);
            cmd.Parameters.AddWithValue("@Line", productionLine);
            cmd.Parameters.AddWithValue("@OperationTaskID", operationTaskId);
            cdConnection.Open();
 
            using (SqlDataAdapter da = new SqlDataAdapter())
            {
                DataTable dt = new DataTable();
                da.SelectCommand = cmd;
                da.Fill(dt);
                ucL1SMT.DataSource = dt;
                ucL1SMT.DataBind();
                ucL1SMT.Data.IncludeColumn(dt.Columns["Shift"],false);
                ucL1SMT.Data.IncludeColumn(dt.Columns["Line"], false);
                ucL1SMT.Data.IncludeColumn(dt.Columns["OperationID"], false);
                ucL1SMT.Data.IncludeColumn(dt.Columns["Hour"], true);
                
 
            }
            
 
        }
 
 
    }
}

  • 7375
    Offline posted

    Hi Trent,

     

    As this is a duplicate case of ‘CAS-178673-H2R4W1’ and can see Mike B is assisting you to that case,

     

    I would recommend you to close this case and continue with the other one.

     

    Please do provide the information to mikeB to get continue support from him.