To limit the plot of a 'fit' function - function

As you see I am new to stackoverflow and Gnuplot, so please forgive me if I am not asking in the right way or right place ! :-
I have a scatter of (Y) data values/points collected over a range of dates. I can plot them against an x-axis of the dates and I have a 'fit' function of the form f(x)= a*x+b.
My problem is that this function extends/plots beyond the date range of the data points if I plot the data in a window which has a date range beyond that of the collected data. ie. the plotted function fills the whole window.
In other words : I want a window space (xrange) over say 50days but while the data is being collected (a few days only) I want the fitted function to occupy only the region of the so-far collected data and to then extend in sync with it as more data is plotted later.
Am I making sense !
Showing the unwanted
Thanks for any help.

Add a separate range for the fit line:
set xrange [10:50] # applies to the entire plot
plot 'data' using 1:2 with points title "Data", \
[12:25] fit(x) with lines title "fit"

Related

Stacked Barplot in R: X-axis values

I came across this code to describe use cases for barplot using iris data from library(datasets).
barplot(table(iris$Species,iris$Sepal.Length), col=brewer.pal(3,"Set1"), main = "Stacked Plot of Sepal Length by Species")
The Barplot generated by this R code
I understand how the code works, but I can't figure out what x-axis means. I think the x-axis on bar plots are supposed to be categories/factors. However, in this case, numeric values are displayed and if these are supposed to be lined up by iris species, I don't understand why they would stack on each other.
Could someone explain what x-axis means here and how I can map the data source for generating x-axis when I cannot trace what's displayed on the x-axis in the future?
Thank you!

SSRS range bar chart, different color when no data

I am looking to change the color in the "gaps" in the range chart that I have built.
Essentially I am trying to build a visualization for the staff to see the availability on bays. The red markings mean the bay is booked, I wanted green then to be in between the red to highlight free bays.
Occupied bays:
I suspect I need to go back to my dataset and add in some date tables to show "null data" to allow a "switch" to work, but I thought someone might know if I could change this without going this way.
An example of the dataset would be:
Following up
here is a screen shot of my output, i added data labels to see if i was going wrong...HOWEVER I also added shadows to my data and my data is actually still there, just hiding behing my secondary bars......
you are right about my data set, i had to add a series grouping to get my appointments all to appear other wise i was just getting the first appointments on the row only to appear....
Following up 2
A further follow up, I have followed #iamdave 's excellent RangeChart.RDL
I have applied my dataset to it but I am now getting the following output, I know I am probably missing something simple, my gut is telling me the cust_id are seperating all the appointments on to seperate lines yet I have both the primary and secondary axis set to "DrawSideBySide = False"
Here is my set up..
here is my latest output, if I could just group all the rows/bars/lines down to the 6 bays it would be great.
You can do this by adding in another data series based on your original dataset, that will require significantly less processing than filling in all your empty periods as suggested by WEI_DBA.
In your dataset, add a new column that returns dense_rank() over (order by BAY) as BayID (order by should be your desired axis label).
This may be best done as a wrapping select statement to preserve the rest of the query logic as is.
In your Range Chart, add in another Values item, with the same Category Field as your current one.
Set the Top Value to 1 and your Bottom Value to 0.
You could also set this to the min and max time of your dataset or the start and end period of your report to only cover the period the Bay was available.
Set it to display on the Secondary Axis for both Vertical and Horizontal axes.
Also select the Do not show this series in a legend option.
Set up the Secondary Vertical Axis in exactly the same way as your Primary Vertical axis.
Set the Secondary Horizontal Axis Minimum and Maximum to the same values as your Bottom and Top above.
Hide both the Secondary Axes.
Select the new Values item and in the Properties window, expand the CustomAttributes section and change DrawSideBySide to False.
If necessary, adjust the order of the Values items in your Chart Data window to make sure the new Range Bar displays underneath your actual data.
Select the original Values item and in the properties sidebar navigate to Data > DataPoint:
Change AxisLabel to =Fields!BAY.Value (Your axis label).
Change Values > X to =Fields!BayID.Value (Value from point 1.).
You should now have a range chart that that displays your data on top of a solid bar, that you can set to any colour you require:

SSRS single bar-chart

Good day all,
Please am trying to create a SSRS report that looks like the image below
i have my table structure in this manner
Please note the data are not in relation with the chart
But all i could get as a result is a multiple bar chart. that resembles the image below.
Thanks in anticipations of your response
First of all, your "Balance on COC" is negative. That's probably not just a chart visualization issue.
You can format the numbers on the y-axis to be more readable like they are in your first screenshot. Click on the Chart Axis and set the LabelsFormat property to #,0;(#,0).
While numbers in the chart can have up to 16 digits, that is highly unreadable for most people. You might want to consider visualizing the numbers in Billions instead.
To get the labels on the x-axis you'll need to set that field as the Category Group. Then you can delete the legend area from the chart. You can also remove the "Axis Title" areas since they are not needed in this case. This will all make it look more polished like the other image.

SSRS : Overlapping Line in Line Chart

I have created a line chart which has the date as X-axis and Y-axis as calculated median value and its grouped according to "FileName". Problem is that some of the "FileName" has same median values which makes line overlap thus not able to see all the lines. Attached image shows only 5 lines but there are total 10 lines. After running query I found out other 5 has 50 as the median which makes it overlap with one of the line.
I tried using transparency and secondary axis but wasn't able to achieve the desired result. Is there any other solution to try out ? Thanks!
This is more of a data presentation issue than something specific to SSRS. If you are stuck on using a line chart, then I've only used two options:
1) Increment lines to different widths. For example, in a chart with 3 lines, the width is set to 5,3,1 pts.
2) Change the values insignificantly to offset the lines. Obviously this depends on the data being visualized as shifting the line slight (multiply by 0.1) may be allowable or highly discouraged depending on your situation.
Trying to do either option with 10 lines (and up to 5+ stacking) is not going to be very good.
I think Viking is right and you might want to check out other visualization options. Grouped column charts perhaps or just split your chart into multiple charts on the page (i.e. four separate trend charts)

Hide Duplicate Legend Items in SSRS Report Chart

I have a stacked column chart in SSRS that displays data by hour. Included in this data is the meters reading, kVa, Average Temperature and Heat Index for that hour. For some reason, the legend items for the temperature values and the kVa are being repeated for each meter in the dataset. I would like for my legend to have the following values: kVa, Average, Heat Index and each meter number. I included a sample of the chart, the chart data configuration as well as some sample data below. Any idea how I can accomplish this? Please let me know if any other information is required.
Here is a good solution which covers all possible scenarios
go to "Report Properties" (right click in the blank area)
go to variables and add a new variable called myflag, set the value to "true" and deselect Read-Only
go to the "Series Properties" and then to "Legend" and click the expression button next to "Do not show this series in legend"
Type or paste this code:
=IIF( Variables!myflag.Value = true, false, true )
=Variables!myflag.SetValue( false )
and that's it.
hint
You can use the same variable in the same series' visibility expression without the setting part in the second line to avoid overlapping the drawing of the same series on the chart
I couldn't get either of these answers to work for me. Ended up using RowNumber and CountRows in the expression for Do not show this series in a legend property.
=IIF(RowNumber("Dataset")=CountRows(),false,true)
You're getting one set of legend values per series you've added. For each series besides the one whose legend you want to keep visible, right click the series (each top-level row in the "Values" box), choose Series Properties, go to the Legend tab, and check "Do not show this series in a Legend."
I was able to fix my issue using information from this question on stack overflow: https://stackoverflow.com/a/1867343/965213
Go to the Legend page of the series properties you want to include in the chart.
Edit the function for the "Do not show this series in a legend" property.
Use this formula: =IIF(Fields!SerialNumber.Value=Last(Fields!SerialNumber.Value,"MeterDetail"),false,true)
Now the series will only be repeated once instead of once per series group.
Hope this helps!