Imports Microsoft.VisualBasic Public Class OperBaja Inherits System.Windows.Forms.Form #Region " Windows Form Designer generated code " Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. Friend WithEvents DataView1 As System.Data.DataView Friend WithEvents Chart1 As SoftwareFX.ChartFX.Chart Private Sub InitializeComponent() Me.DataView1 = New System.Data.DataView Me.Chart1 = New SoftwareFX.ChartFX.Chart CType(Me.DataView1, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' 'Chart1 ' Me.Chart1.AllowDrag = True Me.Chart1.DesignTimeData = "C:\Program Files\ChartFX for .NET 6.2\Wizard\MulltiSeries.txt" Me.Chart1.Dock = System.Windows.Forms.DockStyle.Fill Me.Chart1.Gallery = SoftwareFX.ChartFX.Gallery.Lines Me.Chart1.Location = New System.Drawing.Point(0, 0) Me.Chart1.MarkerSize = CType(4, Short) Me.Chart1.Name = "Chart1" Me.Chart1.NSeries = 3 Me.Chart1.NValues = 10 Me.Chart1.Size = New System.Drawing.Size(592, 453) Me.Chart1.TabIndex = 0 ' 'OperBaja ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.ClientSize = New System.Drawing.Size(592, 453) Me.Controls.Add(Me.Chart1) Me.Name = "OperBaja" Me.Text = "Grafica Operatividad Baja" CType(Me.DataView1, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) End Sub #End Region Dim clCmp As clsComplejo = New clsComplejo Dim FrmOperBaja As OperatividadBaja = New OperatividadBaja Private Sub OperBaja_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load confChart() cargaGrafica() End Sub Private Sub confChart() With Chart1 'Configuracion del CHART .ToolBar = True .SerLegBox = True .AllowDrag = False .AllowEdit = False '.AllowResize = False .ContextMenus = False .ShowTips = True .Scrollable = True .DataEditor = True End With 'Configuro los ejes del chart Chart1.AxisX.AutoScale = True Chart1.AxisY.AutoScale = True Chart1.Grid = SoftwareFX.ChartFX.ChartGrid.Horz Or SoftwareFX.ChartFX.ChartGrid.Vert Chart1.BottomGap = 20 End Sub Private Sub cargaGrafica() 'NOTA: Las fechas son manipuladas para pasarsecelas al porcedimiento almacenado '****************************** Se declaran variables ************* Dim FechaFinal As Date Dim FechaIni As String Dim FechaFin As String Dim _Cuenta As String Dim _Producto As Integer Dim _Opcion As Integer '****************************** Se establecen valores ************ 'se obtiene la fecha del grid FechaFinal = CDate(FrmOperBaja._Fecha) 'Para obtener la fecha inicial se le restan 30 dias de la fecha del grid FechaIni = DateAdd(DateInterval.Day, -30, FechaFinal) 'A la fecha final se le suman 4 dias de la fecha del grid FechaFin = DateAdd(DateInterval.Day, 4, FechaFinal) _Cuenta = CStr(FrmOperBaja.No_Cuenta) _Producto = CInt(FrmOperBaja._IdProducto) 'formo mi query (se utliza un store procedure) Dim cadSQL As String cadSQL = "" cadSQL = "sbOperatividadBajaGraf " cadSQL = cadSQL & "'" & FechaIni & "', " cadSQL = cadSQL & "'" & FechaFin & "', " cadSQL = cadSQL & "'" & _Cuenta & "' " Try clCmp.fdDataReader(cadSQL) Chart1.DataSourceSettings.DataSource = clCmp.dr Catch ex As Exception MessageBox.Show(ex.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try End Sub End Class