2 Replies Latest reply on Jun 5, 2015 6:49 AM by esancha

    set markerstyles on execution time created trend

    esancha

      Hi!

       

      sorry an advance for my por english,

       

      I'm creating a trend on execution time and then export it on image format.

       

      I would set the markerstyle for every trace, but I don't know how do it, I can't find nothing about on the web, this is my code that runs OK, only need the syntax for apply the markerstyle for every trace, some idea?

       

      Thanks a lot.

       

      '* uso: CrearGraficoyExportarComoPNG "C:\Temp\Grafico.png", 1200, 500, "03/06/15 06:00", "04/06/15 06:00", "FC1:B_026", -10, 2, "FC2:B_026", -7, 5, "FC3:B_026", -4, 8, "FC4:B_026", 0, 12
      '* ESH 03/06/15 12:49
      '*******************************************************************************

      Public Sub CrearGraficoyExportarComoPNG(strRutaImagen As String, lngAnchoGrafico As Long, lngAltoGrafico As Long, strHoraInicio As String, strHoraFin As String, ParamArray Tags() As Variant)
      Dim lngIzquierda As Long, _
            lngSuperior As Long, _
            i As Long, _
            Grafico As Trend, _
            blnCorrecto As Boolean, _
            Formato As TrendFormat

      On Error GoTo CrearGraficoyExportarComoPNG_TratamientoErrores

      If (UBound(Tags) + 1) Mod 3 Then
         MsgBox "El número de parámetros pasados es incorrecto, deberia ser multiplo de tres", vbOKOnly + vbCritical, "ATENCION"
         GoTo CrearGraficoyExportarComoPNG_Salir
      End If

      lngIzquierda = -15000
      lngSuperior = 15000

      Set Grafico = ThisDisplay.Symbols.Add(pbSymbolTrend)
      With Grafico
         ' dimensiones
         .Top = lngSuperior
         .Left = lngIzquierda
         .Height = lngAltoGrafico
         .Width = lngAnchoGrafico
         ' rango de tiempo
         .SetStartAndEndTime strHoraInicio, strHoraFin
         .MultipleScales = True
         ' añado las distintas líneas
         For i = 0 To UBound(Tags) Step 3
            .AddTrace Tags(i)
            '         .TrendElement(i).MarkerStyle = pbCCircle
            ' escalas
            blnCorrecto = .SetTraceScale(Tags(i + 1), Tags(i + 2))
         Next i
         Set Formato = .GetFormat
         Formato.ShowTraceMarkers = True
         Formato.ShowDescription = False
         Formato.ShowTagName = True
         Formato.ShowTitle = True
         Formato.ShowEngUnits = True
         .SetFormat Formato
      End With

      ExportaGrafico Grafico.Name, lngAnchoGrafico, strRutaImagen

      CrearGraficoyExportarComoPNG_Salir:
         On Error Resume Next
         ThisDisplay.Symbols.Remove Grafico.Name
         On Error GoTo 0
         Exit Sub

      CrearGraficoyExportarComoPNG_TratamientoErrores:
         MsgBox "Error " & Err & " en proc.: CrearGraficoyExportarComoPNG del Módulo: " & Application.VBE.ActiveCodePane.CodeModule.Name & " (" & Err.Description & ")", vbCritical + vbOKOnly
         Resume CrearGraficoyExportarComoPNG_Salir

      End Sub      ' CrearGraficoyExportarComoPNG

        • Re: set markerstyles on execution time created trend
          Eugene Lee

          Hi Emilio,

           

          You can add

           

          For Each a In Formato.Elements
          If Left(a.Name, 1) = "P" Then
          a.MarkerStyle = pbCCircle
          End If
          Next a
          

           

          in between

           

          Set Formato = .GetFormat

           

          and

           

          .SetFormat Formato

           

          Hope this helps!

           

          Basically, I am creating a loop through the pen elements of the trend to change the markerstyle to the circle type that you want.

          1 of 1 people found this helpful