RawlinsCross
Active Member
- Joined
- Sep 9, 2016
- Messages
- 437
Good day,
I have data in two columns - first is just date/time data, second is the variable in question. Normally I just set my ChartData (having declared variables earlier) in the following way. But a lot of the data in column two is sequentially identical. So you might get data in column B such as {43, 46, 41, 41, 41, 41, 56, 34, 64, 45, 45, 45, 23, 41, ......}. How do I set my ChartData to plot only those points that are unique sequentially (note: there can be identical numbers within the set, just not next to each other and note that in the case of the 41, I'd want to plot the 3rd number in the set and of course the 14th number in the set.)
I have data in two columns - first is just date/time data, second is the variable in question. Normally I just set my ChartData (having declared variables earlier) in the following way. But a lot of the data in column two is sequentially identical. So you might get data in column B such as {43, 46, 41, 41, 41, 41, 56, 34, 64, 45, 45, 45, 23, 41, ......}. How do I set my ChartData to plot only those points that are unique sequentially (note: there can be identical numbers within the set, just not next to each other and note that in the case of the 41, I'd want to plot the 3rd number in the set and of course the 14th number in the set.)
Code:
Set ChartData = Worksheets("Main Element Profiles").Range("IA7:IA37")
ActiveSheet.Range("B2").Select
Set MyChart = ActiveSheet.Shapes.AddChart(xlXYScatterLines).Chart
With MyChart
.SeriesCollection.NewSeries
.SeriesCollection(1).Name = ChartName
.SeriesCollection(1).Values = ChartData
.SeriesCollection(1).XValues = Worksheets("Main Element Profiles").Range("B7:B37")
.Legend.Select
Selection.Delete
.Axes(xlCategory).Select
Selection.TickLabels.NumberFormat = "m/d/yyyy"
Selection.TickLabels.NumberFormat = "[$-409]mmm-dd;@"
.Axes(xlValue).Select
Selection.TickLabels.NumberFormat = "#,##0.00"
Selection.TickLabels.NumberFormat = "#,##0.0%"
.Axes(xlValue).HasTitle = True
.Axes(xlValue).AxisTitle.Text = "Extraction (%)"
End With