Chart dates unevenly spaced on axis with lots of data - chart.js

problem screenshot
Hey guys, I'm having a problem: as you can see in the screenshot, there are some resolutions that the distance between the last and the second to last dates on x-axis is greater than other ones when you use a lot of data on that axis. Can somebody with a project like that test to see if this happens to every project? Probably this is the way Chart.js handles putting more elements on x-axis, but can I do something about it?
Thank you very much!

Related

Scatter chart Play Axis is limited to 10 elements

In a Power Bi report I'm using a Scatter Chart (bubble) with a Play Axis (months).
But this one is limited to 10 elements (I tried years, days, weeks... always 10). Also it's not a size problem, I already tried to put it on maximum size.
And I would like to have 12 elements (all months). How can I fix that?
[https://i.stack.imgur.com/QkW7f.png]
Thanks a lot
The scatter chart does not limit the play axis to 10 items, the value for those remaining items are null/blank due to which the play axis does not show those values. Please find below the screenshot. So please check the data for those missing categories.
Thanks.

Pandas Plot ax doesn't work when index is Timestamp

Running into an odd problem. I'm trying to plot a dual line graph time series, with the difference between those graphs shown as bars in the same graph.
ax = dfx['diff'].plot(kind='bar')
dfx['p1','p2'].plot(ax=ax,kind='line)
So far, so good, this works and gives me the visual I'd like but because the index is made up of unicode date strings, the x axis is a jumbled mess. So I go back and convert the index into timestamps:
dfx['Date'] = pd.to_datetime(pd.Series(dfx['Date']))
I then reset this new column as the index. Problem is, now when I try to plot it, the x axis is perfect, formatted nicely, but the "diff" bars completely disappear, yet it still shows up in the legend. Feels like whack-a-mole...one problem solved, another appears ;)
Thanks for your help!
Edit: After some testing, I've found that if I show the diff as a line, it's fine, which makes me think it's a problem with continuous vs discrete plotting. I think it's getting confused when attempting to show bar graphs on a continuous timestamp range...but I can't be the only person who's wanted to plot lines and bars on the same graph in pandas...

reverse axis direction for google motion chart

I am creating a gvisMotionChart that displays data from the past 5 years. I would like the initial state to be the most recent date (ex. 2012) and for the chart to move "backwards" in time. I know how to set the initial state to the latest date, but that doesn't reverse the time scale at all it just starts the chart at the end of the timeline.
basically, I am looking for a function for the gvisMotionChart that does the same thing as the "hAxis.direction" function for the google Scatter Chart.
Does anyone know how to accomplish this?
Thanks!!

Google charts API - multiple charts on the same image

Is there a way to display multiple charts on the same image using Google Charts api?
To elaborate:
I have one data series which I want to display as bar chart.
I have another data set which has nothing to do with the first one (well they are correlated but the values are hundred times bigger).
X-axis is for dates.
I want to have second data set displayed as line chart with Y-axis on the left.
I found something similar in "Compound charts" section but as far as I understand markers are calculated based on already displayed data set - and I want to have them independent.
In other words - is it possible to make image like this:
http://chart.apis.google.com/chart?cht=bvg&chm=D,0033FF,1,0,5,1&chs=200x150&chd=t1:30,10,20|60,40,50&chxt=y
but with the line being independent and their values axis being on the right.
I'm sorry I'm not familiar with the terminology - I'm sure there is a name for what I'm trying to achieve.
Thanks!
Only 2 years behind the curve but just to let you know that I have achieved your objective of displaying 2 datasets (one a bar chart, the other a line chart) against 2 different axis scales.
The devil is in the scaling parameter &chds and explicit axis values using &chxr. Essentially, I defined the explicit scales for the x-axis, y-axis and r-axis. and then instructed the scaling parameter to scale each dataset differently.
So for an r dataset between 0 - 10 and a y dataset between 0-2 I would write;
&chds=0,2,0,10 (y then r defined in my axis parameter, i.e. &chxt=y,r)
...and...
&chxr=0,0,2|1,0,10
Let me know if you need more detail!
I've looked into something similar to this before and have used the google chart API a lot. I'm 90% sure the answer is no. Sry :(
Yep it is possible.
Here is an example of two datasets displayed on the same axes. 1 is a bar chart the other is a line graph....
This line - chd=t1:95,1,1,3,10,3,77|95,52,44,24,11,2,1 - allows for the two datasets.
slothistype

Google Visualization Annotated Time Line, removing data points

I am trying to build a graph that will change resolution depending on how far you are zoomed in. Here is what it looks like when you are complete zoomed out.
So this looks good so when I zoom in I get a higher resolution data and my graph looks like this:
The problem is when I zoom out the higher resolution data does not get cleared out of the graph:
The tables below the graphs are table display what is in the DataTable. This is what drawing code looks like.
var g_graph = new google.visualization.AnnotatedTimeLine(document.getElementById('graph_div_json'));
var table = new google.visualization.Table(document.getElementById('table_div_json'));
function handleQueryResponse(response){
log("Drawing graph")
var data = response.getDataTable()
g_graph.draw(data, {allowRedraw:true, thickness:2, fill:50, scaleType:'maximized'})
table.draw(data, {allowRedraw:true})
}
I am try to find a way for it to only displaying the data that is in the DataTable. I have tried removing the allowRedraw flag but then it breaks the zooming operation.
Any help would be greatly appreciated.
Thanks
See also
Annotated TimeLine when zoomed-out, Too Many Datapoints.
you can remove the allow redraw flag.
In that case you have to put the data points manually in your data table
The latest date of the actual whole data
The most outdated date in the actual whole data.
this will retain your zooming operation.
I think you have already seen removing the allowRedraw flag, works but with a small problem, flickering the whole chart.
It seems to me that the best solution would be to draw every nth data point, depending on your level of zoom. On the Google Finance graph(s), the zoom levels are pre-determined at the top: 1m, 5m, 1h, 1 day, 5 days, etc. It seems evident that this is exactly what Google is doing. At the max view level, they're plotting points that fall on the month. If you're polling 1000 times a day (with each poll generating a single point), then you'd be taking every 30,000th point (the fist point being the very first one of the month, and the 30,000th one being the last point).
Each of these zoom levels would implement a different plot of the data points. Each point should have a time stamp with accuracy to the second, so you'll easily be able to scale the plot based on the level of detail.