ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to change weight of line in XY chart (https://www.excelbanter.com/excel-programming/388493-how-change-weight-line-xy-chart.html)

[email protected]

How to change weight of line in XY chart
 
Dear Experts

This macro works fine and plots the xy graph using four columns of
data in sheet1. How can I change the weight of the line for series (1)
from xlThin to xlThick ? I tried using the .SeriesCollection(1).Weight
= xlThick but it did not work. Please help.

thanks

Choi


Sub plotgraph()

'***********START graph plot***********
Sheets("sheet1").Activate
Cells(1, 1).Select
'Lastrow = Cells(Rows.Count, 1).End(xlUp).Row
Lastrow = 20000
StartRow = 10

With ActiveSheet.ChartObjects.Add _
(Left:=6, Width:=228, _
Top:=Cells(StartRow, 1).Top, Height:=240)
With .Chart
.ChartType = xlXYScatterSmoothNoMarkers
.SetSourceData Source:=Sheets("Sheet1") _
.Range(Cells(1, 1), Cells(Lastrow, 2)), PlotBy _
:=xlColumns
.HasLegend = True
.SeriesCollection(1).Name = "=""data1"""
.HasTitle = True
.ChartTitle.Characters.Text = "mydata"
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "t(s)"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Pr(kPa)"
.Legend.Position = xlTop
.ChartArea.AutoScaleFont = False
.ChartArea.Font.Size = 8
.PlotArea.Interior.ColorIndex = xlNone
.SeriesCollection.NewSeries
.SeriesCollection(2).XValues = Sheets("Sheet1"). _
Range(Cells(1, 3), Cells(Lastrow, 3))
.SeriesCollection(2).Values = Sheets("Sheet1"). _
Range(Cells(1, 4), Cells(Lastrow, 4))
.SeriesCollection(2).Name = "=""data2"""
.PlotArea.Width = 220
.PlotArea.Height = 160
.PlotArea.Left = 16
.PlotArea.Top = 40
End With
End With

'***********END graph plot***********

End Sub


Peter T

How to change weight of line in XY chart
 
Hi Choi,

..SeriesCollection(1).Border.Weight = xlThick

Regards,
Peter T

wrote in message
ups.com...
Dear Experts

This macro works fine and plots the xy graph using four columns of
data in sheet1. How can I change the weight of the line for series (1)
from xlThin to xlThick ? I tried using the .SeriesCollection(1).Weight
= xlThick but it did not work. Please help.

thanks

Choi




[email protected]

How to change weight of line in XY chart
 
thank you very much Peter. It worked !!

Choi


Jon Peltier

How to change weight of line in XY chart
 
Next time, do it yourself while recording a macro. That's probably what
Peter did, and what I would have done if he hadn't already answered.. You'll
get the syntax correct in two seconds.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


wrote in message
ps.com...
thank you very much Peter. It worked !!

Choi





All times are GMT +1. The time now is 10:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com