Amchart error with the baseInterval set as month - amcharts

I trying to use amchart setting
dateAxis.baseInterval = {
"timeUnit": "month",
"count": 1
}
But i have an error to show the data, when i have more than one day in the month with data, the graph show more than one bullet for the same month.
for example if I have the next data
2019-10-11 => 20
2019-10-12 => 30
in place to display
(2019-10) => 50
the graph show the next data
(2019-10) => 20,
(2019-10) => 30
Thanks in advance.

AmCharts v4 doesn't aggregate your data for you. baseInterval merely tells the chart how to render your data with the minimum intervals between your points. Setting it to month with multiple data points in the same month will display multiple points; this is as designed.
If you intend to display your data in monthly intervals and have some data points where more than one point is in the same month, you need to manually aggregate your data beforehand - in your case, convert that point to a single data item in October with a value of 50.

Related

How can I turn this into multiple line plots?

I assigned the x - axis as the number of days, 365, and my response variable for y-axis. However, upon using seaborn, it sets my x-axis as the whole number of rows I have.
Dataset
sns.lineplot(x="DATE", y="TMEAN", data=TS, hue="YEAR", style="YEAR") plt.show
Lineplot Result
I tried to use pivot and melt, but to no avail.
An easy way to fix your problem is to use the "day of the year" instead of the column "DATE". You can extract that as a separate column from the date like in this example:
data = {'DATE': pd.date_range(start='2013-01-01', end='2021-12-31'),
'YEAR': pd.date_range(start='2013-01-01', end='2021-12-31').year,
'DAY': pd.date_range(start='2013-01-01', end='2021-12-31').dayofyear,
'TMEAN': your_temp_data}
TS = pd.DataFrame(data=data)
sns.lineplot(data=TS, x='DAY', y='TMEAN', hue="YEAR")
plt.show()
Here, the "dayofyear" gives you your x-axis (being each day without the information of which year the temperature belongs to) and the coloring hue visualizes the year.

Extracting weekly or monthly data from a daily Daru time series

I am trying to understand how to obtain weekly or monthly data from a daily Daru time series.
Given this sample time series:
require 'daru'
index = Daru::DateTimeIndex.date_range start: '2020-01-15',
periods: 80, freq: 'D'
data = { price: Array.new(index.periods) { rand 100 } }
df = Daru::DataFrame.new data, index: index
I would like to:
Create a new monthly data frame with only the last row in each month.
Create a new weekly data frame with only the last row of each week.
In fact, I am not sure if I need to create a new data frame, or just query the original data frame.
The objective is to be able to plot weekly and monthly percentage change.
I am not even sure if this operation is something I am supposed to do on the index or on the data frame, so I am a bit lost in the documentation.
Any assistance is appreciated.

Displaying Max, Min, Avg across bar chart Tableau

I have a bar chart with X axis as discrete date value and Y axis as number of records.
eg: x axis (Filtered Date)- 1st Oct, 2nd Oct, 3rd Oct etc
y axis (Number of Records)- 30, 4, 3 etc
Now, I have to create a table to get Max, Min and Avg. Value of the 'Number of Record'.
I have written a Calculated Field as MAX([Number of Records]) to get the maximum of Number of Records in this case 30 but I always get a value of 1.
How do I define the values to get max, min and avg. ?
Thanks,
Number of Records is an automatically calculated field that tableau generates when importing a datasource. You can right click on it and see the definition of the calculation: 1.
As you currently have your field defined, tableau will look for the maximum value of the column. It will always be 1 because that is the only value in that field for every record.
It sounds like you are actually trying to calculate the maxiuum of the sum of the number of records for your aggregation level (in your case date). You should be able to easily accomplish this using Level of Detail (LOD) expressions, or table calculations. Something like the following:
WINDOW_MAX(SUM([Number of Records]))

spotfire data limiting on filtered values

I am trying to limit the visualization on only one month of the filtered values.
I want to my graph be on The Max([Date]) of my data.
I ve added [Date]=Max([Date]) on the Data limiting of my Viz but that's not working when I dont select the Max([Date]) of my Data.
For example:
My column :
Date
12/2015
11/2015
10/2015
My data liminting:
[Date] = Max([Date])
=> When All values are selected it display data for 12/2015
=> When Only 11/2015 and 10/2015 it does not display anything because I think it keeps the Max of all elements and not only on filtered elements
Any one can help ?

Google Analytics API "ga:day" dimension and more than 1 month of data returns aggregate instead of absolute values

I am attempting to retrieve Google Analytics daily visitor counts. I'm following this blog post.
For under 30 days of consecutive data, everything works great. The problem is that the result rows get "grouped together." Consider this query:
{ ids: 'ga:44339606',
'start-date': '2013-01-01',
'end-date': '2013-02-14',
dimensions: 'ga:day',
metrics: 'ga:visits',
segment: 'gaid::-1' }
The values returned for days 01 -14 are incorrect, because they actually represent the sum of January 1st + February 1st, and the sum of January 2nd and February 2nd, and so on. In other words: there is only one entry returned for each day of the month, 1-30, instead of returning 44 entries.
How can I adjust for this, without breaking the query into multiple calls?
Turns out, I wanted the ga:date dimension instead of ga:day
Check out the playground; it's great for figuring out params: https://ga-dev-tools.appspot.com/explorer/

Resources