Oracle SQL Developer plot scatter graph - sql

I'm attempting to use the report function within Oracle SQL Developer to plot a scatter graph of my data. The scatter graph should be fairly simple: one field on the X-axis again the second on the Y-axis. This is the query I'm using to pull the required data and group it together:
SELECT
customer_x_coord,
customer_y_coord
FROM
customers
GROUP BY
customer_x_coord,
customer_y_coord
The data type of both fields is 'NUMBER'.
I'm using this as the SQL for the report and changed the style to chart and the chart type to scatter. But then I can't get the data map correctly. I'm presented with mapping options: 'Group' 'Series' and 'Value'. How do I use these options to create a graph that plots customer_x_coord on the X-Axis against customer_y_coord on the Y-Axis?

As SQL Developer said, you need to have 3 values returned by your query. If there's none, make it! For example:
select
'My graph' as series, --> this
customer_x_coord as group,
customer_y_coord as value
from customers
group by customer_x_coord,
customer_y_coord
series value won't change (its is a constant) but it doesn't matter; now you have 3 columns, so use them to plot the graph.

Related

Grouped Bar Plot with Multiple Numeric Fill Variables

I'm used to creating grouped bar plots like this:
new_data<-data%>%
mutate(new_variable=ifelse(variable<100, "Low", "High"))
ggplot(gap,aes(x=random_variable, fill=new_variable))+geom_bar()
Basically I create an additional column that distinguishes any numeric value in the original column I'm using for this example called "variable," and then using "ifelse" it knows how to categorize the new column called "new_variable"
However, can someone please help me separate the fill into three or more levels, for example:
<10, 10-19, 20-59, 50-100, >100
and then generate a grouped bar plot with multiple filled variables based on these numeric conditions?

Can I build an Access chart including series with SQL?

I am trying to build an Access chart that involves the three fields: Days_Since on the x-axis, Rate on the y-axis, and for the points to be grouped together by Type in a series. I am wondering if this is possible using SQL code. I have tried the built-in Access formatting features and they are not seeming to give me what I want. Also, I would like to note that I do not want any of my data summarized. My current SQL code is below and it is displaying without error.
SELECT [Days_Since],[Rate] FROM [Change]
Try an XYScatter chart with RowSource like:
SELECT Days_Since, IIf([Type]="A",[Rate],Null) AS TA, IIf([Type]="B",[Rate],Null) AS TB, IIf([Type]="C",[Rate],Null) AS TC
FROM Change;
Calculate as many "TYPE" fields are there are type values, hopefully not many.

PowerBI Dynamic Time Series BarChart

Adding on my previous question here: TimeSeries question
I would like to plot a unit capacity chart over a Time series (which contains a range of dates set by the user).
The chart I am trying to plot is as follows:
For each Unit Name, I have start and end date for the unit capacities, as shown in the PowerBI table as below:
4 sub questions:
How to plot these capacities over time? Maybe using some DAX functions?
Do i need the SSAS cube to solve this problem or can I do all the work inside PowerBI desktop? If not, is there a better way for example in SSRS?
Is there a way to make the x-axis time series dynamic as specified by the user?
Adding to this, after Leonard's response. After converting the OutageStartDateOrig, and OutageEndDateOrig values I tried to create the calculated column as suggested in the youtube link {enter link description here}. However, the DAX formula as shown in the video gives out a syntax error for me stating that the '.' is incorrect when specifying the range of dates. Any ideas for this? [Screenshot below]:
To create such a visual, I'd recommend an area chart (or stacked area chart) with the date on the axis, the unit name on the legend, and the capacity on the values. You could also do it as a stacked column chart too. However, then each date will be broken into discrete columns. See below image.
In terms of data manipulation, you'll need to convert the data with the date ranges you have above into a row for each individual date & unit. E.g. the first row, instead of being 11/2 to 13/2, would be expanded into 3 rows, one for each date.
You can do this in Power Query as you bring the data into Power BI Desktop, or in DAX after bringing it in. There are several solutions to this outlined in this thread (https://community.powerbi.com/t5/Desktop/Convert-date-ranges-into-list-of-dates/td-p/129418), but personally, I recommend the technique (and video) posted by MarcelBeug (https://youtu.be/QSXzhb-EwHM).
You'll also want an independent list of dates (with no gaps) to join the final date column to - otherwise your visual will skip dates when no units had capacity. By default, the chart will begin on the first date with data and end on the last date with data, so in that sense it is dynamic, but you can add a date slicer to give the end-user more control.
Area chart on top, column chart on bottom, date slicer on right filtering Jan-Mar.

SSRS - can I link the axis of two charts together?

am using SQL Server 2012 and Visual Studio 2010.
I would like to link the y axis of these two charts together, is this possible?
M
In the vertical axis properties you can configure the maximum value for the axis with an expression. Then check whichever dataset contains the largest value and set it to that (optionally adding a bit of padding if you need to).
You can check the maximum value of each dataset by scoping the MAX() function to the particular dataset.
Your expression for the maximum axis value would look something like this:
=IIF(MAX(Fields!c.Value, "DataSet1") > MAX(Fields!c.Value, "DataSet2"), MAX(Fields!c.Value, "DataSet1"), MAX(Fields!c.Value, "DataSet2"))
In this case there are two datasets named "DataSet1" and "DataSet2" and they both have a field named c which is the value displayed on the chart.
Note: This won't work if you're applying filtering to the data on the chart or you're doing aggregations based on the grouping. There may be a different scoping you can use in that case but I'd have to play around with it to figure it out.

How to pivot a line graph in SSRS

I have the following dataset:
Which creates the following line graph with Roletype as the category group and experience as the value:
How can I pivot this graph so Roletype is on the y axis and values are on the x axis?
I think you are actually using an area chart rather than a line chart, but both function the same way. The y-axis measures a numerical value. You indicate what is on the y-axis by placing something in the values area. If you use a field that isn't a number, it's going to try to sum it or count it or aggregate it in some way. You should use a different chart type to effectively display non-numerical data (see this article about choosing the correct chart type). If you want to assign values to your role-types and then display the description on the axis you could do that. I wouldn't necessarily recommend it as an effective way to communicate your message.
To show use the values for the y-axis, add the role-type values field to your dataset. Use that in the values for your chart and aggregate by avg. Follow the instructions in the accepted answer here. You basically set the number type for your vertical axis labels to custom and then add the list of possible values. This only works if you know exactly what values you are expecting.