Highstocks fixed x-axis with ordinal true - javascript

I am using Highstock.js to build a stock ticker that spans three days. I am using a line to graph the S & P 500 vs time, and I have a data point for every minute the market is open. I also have a feed sending a new data point every minute. When the page loads the previous two days of data is loaded into the chart, plus all the data available so far today. Then I update with new data each minute.
All data is displayed correctly, but I am trying to split the x-axis into thirds (with no gaps). Each third would correspond to each day. This means the last third would only be partially filled while the current day's data is coming in. The line graph would be moving toward the edge of the chart.
The issue I am running into is that the line always fills the entire chart.
I have tried setting the xAxis.max, but this doesn't work unless I set xAxis.ordinal = false. but that leaves gaps for nights, weekends, holidays, etc...
I have also tried sorting and ignoring the x value, but it has become a headache to account for weekends and holidays. Plus I don't know how to get the axis labels back to the correct time.
Basically I'm asking, Is it possible to create a chart that is only partially filled, without ordinal = false

Related

Javascript line graph with tics and difference bar

I'm trying to create a chart similar to the one on the link in JavaScript (going to have the chart in Design Studio). I need there to be a line chart with the current years data and tick marks under with last years data. Between the line chart and the tick I want a bar connecting the two.
I've tried several things but I can only get somewhat close. Due to a few outliers, I also need to keep all values above a certain value and below a certain value to stay in a certain range to avoid the plummets seen.
This graph was created in Excel.

How to modify interpolation at end points for stacked area graph?

I have a stacked area chart that I'm building using D3.js, but I haven't been able to figure out how to get the end-points of my data to behave properly. Here's a screenshot showing the "issue" I'm seeing:
The data associated with both the orange and dark blue segments start on the beginning of their corresponding months (February 1 and March 1, respectively). However, because the default interpolation mechanism "smooths" the curves, it appears as if non-zero values are present on days prior to the start of the month.
How can I get these end-points to drop vertically? I'm aware of the step-before and step-after interpolation models, but I like the look of the default chart. I simply want the ends to "behave" properly. Here's a mockup of what I envision it would look like:
Is this kind of thing even possible?
To be complete, I ended up switching to the step- style interpolations for my graph, since it provides a more accurate picture of my data.

Plot multiple irregular timeseries on same line chart dojo

I am looking to create a line chart which will plot an array of data which has a corresponding x value (date/time) and y value associated with it. The chart can have any number of series (different lines on the same graph). You can think of this as like how yahoo/google graph a particular stock and if you want to compare different companies stock prices on the same chart.
The problem I am facing is that the data I am given might not be given in regular intervals (e.g. series 1 might give an array of plots that occur every 15 mins, series2 might be 10 mins, etc). Also the data might not have the same start / end time (e.g. series 1 starts at 8:40 am, series 2 starts at 8:42 am). There can also be holes in the data where no data was gathered (want to display this as nothing in the chart)
I have thought about some potential ways to solve this problem
Put everything on a 1 minute interval (the smallest possible interval) and place null values for everything we do not have data for. I need to have null values because there are datatips on the graph when you hover over a point to tell you what the value is at that point. The problem with this is that this will cause the graph to become a point graph rather than a line graph and will look ugly. I can tell dojo to interpret the data between null values but I also want to have explicit null values (e.g. when the market is not open leave the space as nothing rather than connecting the lines)
Round the data to the closest interval. The problem with this is the data is no longer accurate for that particular moment which is a problem.
Don't allow them to be plotted together (not an option).
Use a different charting library (last resort)
I am using the dojox charting library and I cannot change the back end code that gives me the data.
What are my options?

highcharts reversed x-axis label stepping

I have several highcharts graphs that display data over a date-range that can be customized by the user. In cases where the range specified is very long and granular, I tell highcharts to skip x-axis labels by setting xAxis.options.labels.step to some value n.
My problem is that this usually results in the last date on the x-axis not being displayed. Highcharts will by default always show the first (left-most) date, then show every nth label up to the edge of the graph, but this won't always include the final label.
For my use case, I would prefer the opposite: I want the final date to always be displayed and then show every nth date moving to the left, not necessarily including the first date. Is there a knob I'm missing that would allow me to tweak highcharts to obtain this behavior?
Thanks!
I decided to use tickPositioner and just apply the date formatting manually. I managed to find a way to do this such that the x-axis labels show up appropriately.

Stacking bars in a Flot chart with time series

I have a Flot chart and x-axis displays time - tick size equaling one day. I am displaying durations of events that take place at various times of the day and I would like to stack them. Flot's time mode positions the bars based on milliseconds so the bars are apart in each tick/day. Is there a quick way of making the bars stack up, preventing them from being plotted in different x positions in each day?
Having mixed feelings answering my own question, but I'll do it anyway in case someone runs into a similar issue.
The solution is to convert timestamps to days, round down the decimal in the result, and convert it back to milliseconds using a function like:
Math.floor(date/(1000*60*60*24))*(1000*60*60*24)
Also, make sure to set the tick size to one day in your axis settings declaration:
tickSize: [1, "day"]
As a result, you will end up with day values that stack up beautifully. I ended up doing the conversion on the client side so that I can store precise values, while the graph shows a bigger picture.

Categories