Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
239 views
in Technique[技术] by (71.8m points)

reporting services - Line Chart with multiple colors for single line and multiple icons

need a Line chart as below that is filtered by Country->Customers->MachineType->MachineModel->Parts.

The Chart represents Consumed Material (In Tons) of Machines in Y-Axis and X-Axis is over time (Year-Months-Day).

My data is coming from a ML model that stores value for past 3 months and next 365 days.

  1. How can I show the actual and predicted value in the same line with different colors? I can't use two lines to represent this.

  2. How can I display multiple (around 100) icons ( Represented as Xs in below Picture) on the same line to represent another field value maintenance dates of Parts.

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You can do this quite easily with a single dataset and a single line if you get the dataset right.

I've mocked up a small sample of data using the following...

This assumes two tables, one with material use and another with maintenance days

DECLARE @t TABLE(DateStamp date, Amount int)

INSERT INTO @t VALUES
    ('2021-01-01', 10),
    ('2021-01-02', 11),
    ('2021-01-03', 12),
    ('2021-01-04', 14),
    ('2021-01-05', 16),
    ('2021-01-06', 18),
    ('2021-01-07', 20),
    ('2021-01-08', 21),
    ('2021-01-09', 22),
    ('2021-01-10', 23),
    ('2021-01-11', 24),
    ('2021-01-12', 25),
    ('2021-01-13', 26)

DECLARE @m TABLE(DateStamp date)

INSERT INTO @m VALUES
    ('2021-01-01'),
    ('2021-01-02'),
    ('2021-01-06'),
    ('2021-01-07')


SELECT t.*, CASE WHEN m.DateStamp IS NULL THEN 0 ELSE 1 END as Maintenance
    FROM @t t 
        LEFT JOIN @m m on t.DateStamp = m.DateStamp
    

Using this as my dataset query I get the following data returned.

enter image description here

Now all I did was add a line chart with amount as the value and datestamp as the category group.

I then clicked the series line and changed the following properties...

Color

=IIF(Fields!DateStamp.Value <= Today(), "Blue", "Red")

MarketType

=IIF(Fields!Maintenance.Value=1, "Diamond", Nothing)

... and finally set the maker size to 15pt for clarity in this example.

enter image description here

This gave me the following output

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.8k users

...