cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Plot 2 datasets with different x-values on the same line chart

Hi all,

 

I have two distinct datasets which have different x-values. I would like to plot these on a same line chart. 

So I would like to plot Y , Y2 and Y3 together. 

First, I made Dataset1:

 

ClearCollect(Dataset1,
{X:1.40, Y1:14.49, Y2:12.96},
{X:1.70, Y1:12.01, Y2:11.02},
{X:2.00, Y1:10.06, Y2:9.36},
{X:2.20, Y1:9.00, Y2:8.43},
{X:2.50, Y1:7.72, Y2:7.29},
{X:3.00, Y1:6.20, Y2:5.96})

 

Then Dataset2:

 

ClearCollect(Dataset2,
    {X:2.3, Y3:5.7},
    {X:2.65, Y3:6.7}
    )

 

And finally Dataset3 which combines the two:

 

ClearCollect(Dataset3,{X:Value(Blank()),Y1:Value(Blank()), Y2:Value(Blank()),Y3:Value(Blank())});
Collect(Dataset3,Dataset1);
Collect(Dataset3,Dataset2);
Remove(Dataset3,First(Dataset3))

 

 

This combines the two tables, however, whenever I plot Dataset3 on a line chart, it treats the two additional points of Dataset2 as two separate points (see attached screenshots). What I would like is to have them in the right place on the x-axis of the graph (that is 2.3 should be between 2.2 and 2.5 etc. like you can on x-y chart in Excel). Does that make sense?

 

These points were taken as an example, in reality I will put an input variable which will change dynamically based on user input. Not sure if that's possible to do on a line chart in PowerApps . Any help would be appreciated?

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Anonymous ,

Based on the needs that you mentioend, if you want to display the Line Chart as that in your Excel within your app, I afraid that there is no way to achieve your needs.

 

Currently, there is no function supported within PowerApps to get rid of '0' point within the Line Chart control. If you would like this feature to be added in PowerApps, please consider submit an idea to PowerApps Ideas Forum:

https://powerusers.microsoft.com/t5/Power-Apps-Ideas/idb-p/PowerAppsIdeas

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
mdevaney
Super User
Super User

@Anonymous
I’d love to try and help you here but I don’t exactly understand what you want to do. Would it be possible to prepare the chart you desire in Excel then attach it as an image here? Then we can attempt to rebuild it in PowerApps.
v-xida-msft
Community Support
Community Support

Hi @Anonymous ,

Do you want to render the Dataset3 (combined dataset) within your Line Chart, and the X value should be sorted in specific sort order, e.g. Ascending?

 

Based on the needs that you mentioned, I think the SortByColumns function could achieve your needs, I have made a test on my side, please consider take a try with the following workaround:

2.JPG

 

3.JPG

Set the OnStart property of App control to following (modify your formula as below: )

 

ClearCollect(
            Dataset1,
           {X:1.40, Y1:14.49, Y2:12.96},
           {X:1.70, Y1:12.01, Y2:11.02},
           {X:2.00, Y1:10.06, Y2:9.36},
           {X:2.20, Y1:9.00, Y2:8.43},
           {X:2.50, Y1:7.72, Y2:7.29},
           {X:3.00, Y1:6.20, Y2:5.96}
);
ClearCollect(
            Dataset2,
            {X:2.3, Y3:5.7},
            {X:2.65, Y3:6.7}
);
ClearCollect(TempCollection, Dataset1, Dataset2);
ClearCollect(
             Dataset3, SortByColumns(TempCollection,"X")
);

 

Set the Items property of the Line Chart control to following:

 

Dataset3

 

Set the NumberOfSeries property of the Line Chart control to following:

 

3

 

configure Labels proeprty to X column, and Series1, Series2, Series3 to Y1, Y2, and Y3.

Please consider re-load your app (fire the OnStart property of App), then check if the issue issue is solved.

 

In addition, you could also consider directly type the following formula within the Items property of the Line Chart control:

 

SortByColumns(Dataset3, "X", Ascending)

 

4.JPG

then configure the Series property and Labels property as above.

 

Please consider take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

@v-xida-msft 

Thanks a lot for this answer, this is almost what I was looking for. However, perhaps you know how to get rid of 0 points, where the series (Y1,Y2. and Y3) intersect with x axis, because their corresponding y-value is blank (see attached). So ideally it should look like this (see excel graph attached). Is that possible with a line chart?

 
 
 
 

Hi @Anonymous ,

Based on the needs that you mentioend, if you want to display the Line Chart as that in your Excel within your app, I afraid that there is no way to achieve your needs.

 

Currently, there is no function supported within PowerApps to get rid of '0' point within the Line Chart control. If you would like this feature to be added in PowerApps, please consider submit an idea to PowerApps Ideas Forum:

https://powerusers.microsoft.com/t5/Power-Apps-Ideas/idb-p/PowerAppsIdeas

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

secondImage

Power Apps Community Call

Please join us on Wednesday, October 20th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (1,950)