Thêm 1 đường kẻ nằm ngang vào 1 đồ thị cho trước

Liên hệ QC

ptm0412

Bad Excel Member
Thành viên BQT
Administrator
Tham gia
4/11/07
Bài viết
13,762
Được thích
36,257
Donate (Momo)
Donate
Giới tính
Nam
Nghề nghiệp
Consultant
Add a Horizontal Line to a Column or Line Chart: Series Method.
Thêm 1 đường kẻ ngang vào đồ thị.

How do you add a nice horizontal line to a column or line chart, to show a target value, or the series average? The method involves adding a new series, applying it to the secondary axes, and making the secondary axes disappear.
Use this data to make a column or line chart. The blank cell in the upper left of this range tells Excel that "Value" is the series names, and the dates in the first column are the category (X axis) labels. (I use dates in this example, but you could use any type of category labels.)
Có cách nào thêm 1 đường kẻ nằm ngang vào 1 đồ thị dạng cột hoặc dạng đường kẻ nhằm đưa vào 1 đường biểu diễn 1 mục tiêu, hay là 1 giá trị trung bình? Ta có thể dùng 1 serie dữ liệu trung bình như sau vào dữ liệu có sẵn, nhưng đường kẻ này không đi ngang qua hết bề ngang đồ thị.

HorizonLine02.gif
---------
HorizonLine01.gif

Ta phải dùng cách khác: Thêm vào 1 serie dữ liệu, nhưng dùng trục tung thứ hai, và làm cho trục tung này biến mất. Dùng lại dữ liệu bảng trên, chỉ dùng cột chữ xanh. Ô trống ở trên cùng bên trái nhằm chỉ cho Excel ô Value là tên serie cữ liệu, và cột có giá trị ngày tháng là các giá trị hiện trên trục hoành. Tạo 1 đồ thị dạng cột hay dạng đường kẻ như 2 hình sau:

HorizonLine03.gif
HorizonLine04.gif

In a free section of your worksheet, set up a range with X and Y values corresponding to the endpoints of your indicator line, shown below. The X value ranges from 0 to 1; we will use the secondary X axis for this line, and scale its min and max to 0 and 1. The Y value corresponds to an average or other significant level you want to indicate on the chart.
Trong 1 vùng trống của sheet, tạo 1 vùng dữ liệu cho các giá trị x và y như bảng dưới, và dùng trục hoành thứ 2 cho nó, trên trục này lấy giá trị nhỏ nhất là 0 và lớn nhất là 1. Giá trị Y là các giá trị trung bình hoặc 1 giá trị nào tuỳ bạn.
|Average
0-|9,5​
1-|9,5​




Select and copy this range, select the chart, and from the Edit menu, choose Paste Special. Select the New Series, Categories in First Column, and Series Names in First Row options. The new series has the same style (Column or Line) as the first series.
Chọn và copy vùng dữ liệu này, vào menu Edit, chọn Paste special, chọn new serie, categories in First Coumn và Series Name in First Row. Serie mới này sẽ có cùng dạng biểu đồ cột hoặc đường kẻ với serie trước đó.


HorizonLine06.gif
HorizonLine07.gif

 
Add a Horizontal Line to a Column or Line Chart: Series Method.(continue)
Thêm 1 đường kẻ ngang vào đồ thị (tiếp theo)

Right click on the new series "Average" and select Chart Type from the pop up menu. Choose the XY Scatter type, subtype Scatter with data points connected by lines without markers. The series changes and secondary axes appear on the chart.

Click chuột phải vào serie Average, chọn lại Chart type là Xy Scatter, mục Scatter with data points connected by lines without markers. Đồ thị cho serie này sẽ đổi, và các trục đố thị mới xuất hiện:

HorizonLine08.gif

HorizonLine09.gif

Now it's time to neaten up the axes. Double click on the secondary X axis, and on the Scale tab, set 0 for Minimum and 1 for Maximum. On the Patterns tab, choose None for Major and Minor Tick Marks and for Tick Mark labels to make the axis disappear.
Select the secondary Y axis and press Delete (or more formally: right click on the chart, choose Chart Options from the Pop Up menu, click on the Axes tab, and uncheck the box for the Secondary Y Axis).
Giờ thì ta kéo dài đường này đến hết đồ thị và xoá bớt các trục không cần thiết. Trước tiên click đôi vào trục hoành thứ hai, trong tab Scale, chọn Min là 0 và Max là 1. Trong tab Pattern, chọn None cho Major tick và Minor tick, chọn luôn none cho Tickmark Label cho khp6ng còn nhìn thấy trục này nữa.
Còn trục tung thứ 2 bên phải, bạn chỉ cần click chọn nó và nhấn delete; hoặc bài bản hơn thì vào Chart Option, trong tab Axes, bỏ chọn ô Secondary Y Axis.

HorizonLine10.gif
HorizonLine11.gif

All that may be left is some embellishing of the chart. I removed the legend, added data labels (Show Values option) to the original series, and a data label to the last point of the horizontal line series. Then I colored the label text to match the series color.
Còn lại 1 tí nữa thuộc về trình bày: Xoá bỏ cái chú giải (legend), thêm cái Data label (chọn Show Value trong Format series cho serie dữ liệu gốc, thêm label cho điểm cuối đường trung bình (cứ việc thêm Show value cho nó, rồi xoá riêng cái label đầu tiên). Cuối cùng định dạng màu label cho hợp với màu series.

HorizonLine12.gif
HorizonLine13.gif
 
Web KT
Back
Top Bottom