Format Y axis tick mark numbers - javascript

I am using the annotated timeline visualization and I am wondering if
it is possible to format the numbers that are on the side of the Y
axis ( on the Y-axis 'tick marks').
What I need explicitly is a way for these numbers to be truncated to
whole integers, and not display the decimal parts, so they do not take
as much space.
I've gone through the API documentation and there doesn't seem to be a way to do this. Am I wrong?
Thank you,

Related

Get percentage of values within standard deviation range

I am looking for a way to calculate the percentage chance of a data point falling within X standard deviations using Javascript.
Based on this article I would expect it to return ~68% for X=1, ~95% for X=2, and ~99.7% for X=3.
The whole number answers are easy to find online, but I am looking for a programatic way to calculate this number for X=2.45 for example.
Thanks in advance!

D3 timeScale remove month boundary tick

I'm trying to build a box plot representing stats of a lot of data(x-time, y-time) The idea is to use d3.extent() to get the domain and then feed it to timeScale to get ticks in nicely chosen intervals. Then I calculate stats for data points between the ticks. Example below:
The approach works well most of the time. Except for the 1st day of the month which creates an additional tick in an uneven spacing ( see above "Wed 31, June" ). I'm currently calculating bar widths and positions manually assuming that the ticks are spaced evenly so the whole chart gets broken.
The data can span any range of time from a week to couple years, so dynamic ticks are required.
Any ideas how to remove the additional tick or make all the ticks spread evenly?
EDIT. Not sure if removing the tick is going to do the trick... probably even spacing is more important here. I looked up other people's questions about similar problems but I'm still confused how to solve my problem.
I've just started using D3 so forgive me if the question is trivial. I'll be happy if you just point me in the right direction.

Q: Plotly.js Linking 2 X Axes

In Plotly.js I am trying to allow users to see two (related) values for positions on the x axis. (Think if I'm doing dates I want it to say "Tuesday" on the lower axis and June 28th 2016 on a linked axis) Linking the axes would preferably preserve the relation between values when scrolling or zooming.
I had a temporary solution in place, where I would change the values from floats (as that was what we were using) to strings with a break character intended to separate the values (which allowed viewing both values at once albeit on one axis), however when tested with floats that were not equally spaced the slope would change visually, which is not desired. Another solution I have tried was to have the ticks be their float values, and then change their values after they were plotted using the "tickvals" and "ticktext" attributes, but I was unable to then hide some tick text while keeping others view-able on the x axis (and with 80 values it became quite busy and unreadable) There is the solution of hiding all of these tick values, but I was hoping there would be a solution where I could see some of them.
I created an example of the problems I am having in jsbin, so I hope it is kosher to link to that. https://jsbin.com/buwuyid/1/edit?html,output (and also hope the link works.)
There was a similar question asked previously, In plotly, how do I create a linked X axis? however that was a year ago and using python, and I was hoping that an implementation that I cannot find has been found, or a solution to one of the other problems I have found could be provided.
Thank you for any help you can provide, and if I can include any more information to help find a solution, please ask.

Linear regression with time series data

I am trying to draw a visualization showing some trend over time.
In my line plot, I have date as the X variable, some other number as the Y variable. I used d3.time scale for x and d3.linear scale for Y. The line plot is fine.
Then I tried to draw a linear regression line, but I failed, because the data for x is not numerical. I searched and searched. This post has a nice adaptable regression code, but that's for numerical data; this post has a graph similar to what I'm shooting, but it uses ordinal scale. I am wondering if there is any simpler way to make the linear regression code reusable for my time series data (e.g., "09-Mar-2016"). Any advice?
I don't know anything about javascript, but I am quite familiar with this problem. One solution: convert those date-times into units from a known date-time, whether seconds, or hours, or days.
If your dataset supports it, take the max and min of your date-times, and subtract the min from each. If you are just stuck with text, you may have to parse the values and do your own calendar math. However, there must be a library to handle this.

Char library which can scale the x axis correctly

I am looking for a chart library in JavaScript.
It have to support Lines (I suppose all charting libraries do that).
I have to support zooming, due to high amount of data.
The problem I have found while using other libraries is scaling the x axis.
I get data by strings:
y=[43,56,34,63....]
x=[24/04/12 22:47,...]
But the number of lines and the interval is specified by the user. Meaning that I can have 50 data or 500 data. The problem comes when I input these dates and times. I cant find a library that will look into the length of the string and then just show maybe 4-5 of them when zoomed out, and show more detailed when zoomed in.
Money is not a problem, but it need to have a trial version.
Edit: I have tried libraries which allow me to set a start date, and then the interval by the points. But my intervals are not constant, so that cant be used either.
Try amCharts. This library supports dates as series. Your job will be to convert your date string into JavaScript Date Object, it's quite a simple task. Here is an example of a chart with date-based data:
http://amcharts.com/javascript/line-chart-with-date-based-data/
Another one with date/time based data:
http://amcharts.com/javascript/area-chart-with-time-based-data/
You can download and try this library.

Categories

Resources