Настроить уравнение отображения - PullRequest
0 голосов
/ 06 мая 2020

Привет всем, я делаю диаграмму в vba, я хотел бы знать, есть ли способ настроить уравнение отображения из линии тренда в vba? У меня следующий код:

With chtp
    .FullSeriesCollection(1).ChartType = xlXYScatterSmoothNoMarkers
    .FullSeriesCollection(1).Name = "Asentamiento Total"
    .FullSeriesCollection(1).XValues = "=" & hojaGrafico & "! " & rangoFecha 'xdatos
    .FullSeriesCollection(1).Values = "=" & hojaGrafico & "! " & Replace(rangoFecha, "A", "D") 'ydatos
    .FullSeriesCollection(1).Format.Line.ForeColor.RGB = RGB(255, 0, 0) 'color de linea
    .FullSeriesCollection(1).Format.Line.Weight = 0.75 'grosor de linea
    .SeriesCollection.NewSeries
    .FullSeriesCollection(2).ChartType = xlXYScatterSmoothNoMarkers
    .FullSeriesCollection(2).Name = "Nivel del lleno"
    .FullSeriesCollection(2).XValues = "=" & hojaGrafico & "! " & rangoFecha 'xdatos
    .FullSeriesCollection(2).Values = "=" & hojaGrafico & "! " & Replace(rangoFecha, "A", "C") 'ydatos
    .FullSeriesCollection(2).AxisGroup = 2
    .FullSeriesCollection(2).Format.Line.ForeColor.RGB = RGB(0, 100, 0) 'color de linea
    .FullSeriesCollection(2).Format.Line.Weight = 0.75 'grosor de linea

    '.FullSeriesCollection(1).IsFiltered = True
    .FullSeriesCollection(1).Trendlines.Add
    With .FullSeriesCollection(1).Trendlines(1)
        Select Case (tendencia)
            Case Is = "Lineal"
                .Type = xlLinear
            Case Is = "Polinomial"
                .Type = xlPolynomial
                .Order = frecogrado
            Case Is = "Logaritmica"
                .Type = xlLogarithmic
            Case Is = "Potencial"
                .Type = xlPower
            Case Is = "PromedioMovil"
                .Type = xlMovingAvg
                .Period = frecogrado
            Case Else
                .Type = xlPolynomial
                .Order = frecogrado
        End Select

        Select Case True
            Case mostrarecuacion
                .DisplayEquation = True
                .DisplayRSquared = True
                .DataLabel.Select
                With Selection
                   .Format.TextFrame2.TextRange.Font.Name = "Arial"
                   .Format.TextFrame2.TextRange.Font.Size = 12
                   .Left = 300
                   .Top = 170
                End With
            Case Else
                .DisplayEquation = False
                .DisplayRSquared = False
        End Select
    .Format.Line.ForeColor.RGB = RGB(0, 0, 128)
    .Format.Line.Weight = 0.75
    End With
End With

есть ли способ настроить и разместить метку уравнения отображения без выбора? я ценю вашу помощь.

...