나는 플롯 차트 개체 및 SeriesCollection.NewSeries 코드의 부분이대칭 엑셀
Private Function AddSeriesAndFormats(PPSChart As Chart, shInfo As Worksheet, tests() As PPS_Test, RowCount As Integer, col As Integer, smoothLine As Boolean, lineStyle As String, transparency As Integer, lineWidth As Single, ByRef position As Integer) As Series
Dim mySeries As Series
Set mySeries = PPSChart.SeriesCollection.NewSeries
With mySeries
.Name = tests(0).GetString()
.XValues = "='" & shInfo.Name & "'!R" & RowCount - UBound(tests) - 1 & "C" & CInt(4 * (col + 1) - 2) & ":R" & RowCount - 1 & "C" & CInt(4 * (col + 1) - 2)
.Values = "='" & shInfo.Name & "'!R" & RowCount - UBound(tests) - 1 & "C" & CInt(4 * (col + 1) - 1) & ":R" & RowCount - 1 & "C" & CInt(4 * (col + 1) - 1)
.Smooth = smoothLine
.Format.line.Weight = lineWidth
.Format.line.DashStyle = GetLineStyle(lineStyle)
.Format.line.transparency = CSng(transparency/100)
.MarkerStyle = SetMarkerStyle(position)
.MarkerSize = 9
.MarkerForegroundColorIndex = xlColorIndexNone
End With
Set AddSeriesAndFormats = mySeries
End Function
같이하고 PPSChart이
처럼 생성을 사용하여 일부 플롯을 수행 한Private Function AddChartAndFormatting(chartName As String, chartTitle As String, integralBuffer As Integer, algoPropertyName As String) As Chart
Dim PPSChart As Chart, mySeries As Series
Set PPSChart = Charts.Add
With PPSChart
.Name = chartName
.HasTitle = True
.chartTitle.Characters.Text = chartTitle
.ChartType = xlXYScatterLines
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).HasTitle = True
If algoPropertyName <> "" Then 'case for Generic PPS plots
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = algoPropertyName
Else
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "PL/PR max(avg_" & integralBuffer & "ms) [mbar]" 'case for the bumper obsolate algorithm
End If
.Axes(xlCategory, xlPrimary).AxisTitle.Text = "Bumper Position [mm]"
End With
' delete random series that might be generated
For Each mySeries In PPSChart.SeriesCollection
mySeries.Delete
Next mySeries
Set AddChartAndFormatting = PPSChart
End Function
결과의 예는 내가 원하는 것은 내가 Y의 왼쪽에있는 값이 없어도 것을, -350에서 시작하여 X 축을 가지고있다 다음은이 그림에서처럼 축 (음의 방향). 실제로, 플롯 된 값이 양수 (Y 축에 대한 최대 X 값과 최소 X 값 사이의 대칭) 인 경우에도 중간에 Y 축이 있기를 원합니다. 가능한지 말해 줄 수 있고 몇 가지 예를 들어 주시겠습니까?
쉽게 사용하기 위해 객체에 시리즈의 값을 할당해야 처음에는 차트를 만들었고 이후에는 값을 읽고 시리즈를 만들었 기 때문에 조금 어려웠습니다. 이 코드는 .Axes (xlValue) .MinimumScale = dMinValue .Axes (xlValue) .MaximumScale = dMaxValue는 계열을 만들 때가 아니라 차트를 만들 때만 작동합니다. –