How do I show the proper time on my intraday chart using AnyChart? - anychart

I have downloaded hourly stock data for AAPL for the past 30 days and am displaying a candlestick chart. The chart loads properly but the time shown for each bar is incorrect. I am in the Pacific time zone.
I tried changing the way the data table is created but none of the ideas below seem to help.
var dataTable = anychart.data.table(0);
var dataTable = anychart.data.table(0, '', 8);
I am using the same example as the one on the AnyChart website https://www.anychart.com/products/anystock/gallery/Stock_General_Features/Showing_Intraday_Data.php
Please see the following 2 images.
For the ORCL chart from the example on the AnyChart website, I clearly see the date and time (highlighted rectangle)
working example from AnyChart website
For my chart (for AAPL hourly data), the time is off and it shows "13 05 Nov 2021" etc.
Does not work for my data
My source CSV file contains data as below (full CSV available at this link)
timestamp,gmtoffset,datetime,open,high,low,close,volume
1634650200000,0,2021-10-19 13:30:00,147.009994,148.820007,146.550003,148.759994,24069759
1634653800000,0,2021-10-19 14:30:00,148.759994,149.169998,148.229995,148.384994,13899143
1634657400000,0,2021-10-19 15:30:00,148.380004,148.759994,148.220001,148.759902,7623131
1634661000000,0,2021-10-19 16:30:00,148.759704,149.044998,148.5,148.889999,6263260
1634664600000,0,2021-10-19 17:30:00,148.884994,148.979995,148.479995,148.535003,4807906
1634668200000,0,2021-10-19 18:30:00,148.539993,148.837295,148.330001,148.460006,6333632
....

Thanks to AnyChart for responding so quickly via email.
The following snippet solves the issue with the tooltips and now I can see the proper date and time on the tooltip.
chart.tooltip().titleFormat(function() {
return anychart.format.dateTime(this.x, 'yyyy-MM-dd HH:mm:ss');
});
To set the proper legend, the following code does it:
plot.legend().title().useHtml(true);
// configure the format of the legend title
plot.legend().titleFormat(
"<span style='font-weight:600'>" +
"{%hoveredDate}{dateTimeFormat: yyyy-MM-dd HH:mm:ss}</span>"
);

Related

SPSS produces 1 scatter plot with split file

I am working with data where I need to create multiple scatter plots for different populations. I also recently upgraded from SPSS v26 to v28 and the code that I used for this worked in v26 but is no longer working correctly in v28. Instead of producing multiple scatter plots like it's supposed to, it is now producing 1 plot in v28, presumably the first subpopulation in the split. I tested the split file function with descriptives and it worked as intended.
I have scoured everything in the GUI menus to find any kind of setting that was ticked by default and came up with nothing. I also tried to use a filter based on the criterion variables in my split file function and ran a scatter plot but that gave me a graph of the whole population instead of the subpopulation I filtered. Any guidance on what could be going on with scatter plots and the split file function in SPSS v28 would be greatly appreciated.
Here is my code for reference:
SORT CASES BY exit_yr service sigscore.
SPLIT FILE SEPARATE BY exit_yr service sigscore.
*Chart Builder.
GGRAPH
/GRAPHDATASET NAME="graphdataset" VARIABLES=wait.time[name="wait_time"]
score.change[name="score_change"] service.ideal[name="service_ideal"] MISSING=VARIABLEWISE
REPORTMISSING=NO
/GRAPHSPEC SOURCE=INLINE
/FITLINE TOTAL=NO SUBGROUP=NO.
BEGIN GPL
SOURCE: s=userSource(id("graphdataset"))
DATA: wait_time=col(source(s), name("wait_time"))
DATA: score_change=col(source(s), name("score_change"))
DATA: service_ideal=col(source(s), name("service_ideal"), unit.category())
GUIDE: axis(dim(1), label("wait.time: Difference in days between referral submission ",
"and referral acceptance"))
GUIDE: axis(dim(2), label("score.change: score change from pre to post"))
GUIDE: legend(aesthetic(aesthetic.color.interior), label("service.ideal"))
GUIDE: text.title(label("Grouped Scatter of score.change: score change from pre to ",
"post by wait.time: Difference in days between referral submission and referral ",
"acceptance by service.ideal"))
ELEMENT: point(position(wait_time*score_change), color.interior(service_ideal))
END GPL.
SPLIT FILE OFF.

How to set anycharts stock scroller to not move size

I have a function on a js to create an anychart.stock
dataTable = anychart.data.table();
dataTable.addData(json);
price = dataTable.mapAs({'value': 1});
height = dataTable.mapAs({'value': 2});
weight = dataTable.mapAs({'value': 3});
var pricesChart= chart.plot(0);
pricesChart.grid().enabled(true);
pricesChart.grid(1).enabled(true).layout('vertical');
PricePlot = pricesChart.stepLine(price).stroke('#004400');
var heightChart= chart.plot(0);
heightChart.grid().enabled(true);
heightChart.grid(1).enabled(true).layout('vertical');
heightPlot = heightChart.stepLine(height).stroke('#334400');
var weightChart= chart.plot(0);
weightChart.grid().enabled(true);
weightChart.grid(1).enabled(true).layout('vertical');
weightPlot = weightChart.stepLine(weight).stroke('#334400');
When the plot is displayed all the scales can be seen OK. See this image:
The problem appears when I move the scroll to the right. It modifies the scale of my last chart causing this chart to be unreadable. See next image:
I just learned what happened to the visualization.
The problem is that given a period of time, for example, this year from 01-01-2019 to 31-12-2019 I am using three different lines to display information.
The first line contains info from 01-01-2019 to today
The second line contains info from today to 7 days ahead
The third period contains info from 7 days ahead to 31-12-2019.
The fact that the lines are not continuous is what is breaking the zoom.

ARIMA MODEL Forecast PLOT in R

I'm currently doing arima forecasting in R and i'm already on the last step of displaying the forecast result but I am having trouble in displaying the forecast on the graph.
Here is my code:
mydata.arima005 <- arima(d.y, order= c(0,0,5))
mydata.pred1 <- predict (mydata.arima005, n.head =100)
plot(d.y)
lines(mydata.pred1$pred, col="blue")
lines(mydata.pred1$pred+2*mydata.pred1$se, col="red")
lines(mydata.pred1$pred-2*mydata.pred1$se, col="red")
So as you can see, I want my graph to show the forecast values in color blue and the confidence interval on red. But this is what I am getting instead.
So as you can see it's not color coded at all. My code contains no error.
This is a sample of the output I am expecting(got it from youtube)I used the same codes used in this video I got thats why i was wondering why my graph doe not look like this.Hope you could help
The forecast package has some functions for displaying nice plots of the forecasts and prediction intervals.
You would need something like this:
library(forecast)
mydata.arima005 <- Arima(d.y, order= c(0,0,5))
mydata.pred1 <- forecast(mydata.arima005, h=100)
plot(mydata.pred1)
Or using ggplot2 graphics:
library(ggplot2)
autoplot(mydata.pred1)

Tapku calender customization

I'm using Tapku calendar for my iOS app. I have something to do like this.
I'm getting a JSON array of data from the web service. It's something like this:
dates":[{"day_id":1,"color_id":1},
{"day_id":2,"color_id":1},
{"day_id":3,"color_id":1},
{"day_id":4,"color_id":1},
{"day_id":5,"color_id":1},
{"day_id":6,"color_id":1},
{"day_id":7,"color_id":1},
{"day_id":8,"color_id":1},
{"day_id":9,"color_id":1},
{"day_id":10,"color_id":1},
{"day_id":11,"color_id":1},
{"day_id":12,"color_id":1},
{"day_id":13,"color_id":1},
{"day_id":14,"color_id":1},
{"day_id":15,"color_id":1},
{"day_id":16,"color_id":1},
{"day_id":17,"color_id":1},
{"day_id":18,"color_id":1},
{"day_id":19,"color_id":2},
{"day_id":20,"color_id":2},
{"day_id":21,"color_id":1},
{"day_id":22,"color_id":1},
{"day_id":23,"color_id":1},
{"day_id":24,"color_id":1},
{"day_id":25,"color_id":1},
{"day_id":26,"color_id":1},
{"day_id":27,"color_id":2},
{"day_id":28,"color_id":1},
{"day_id":29,"color_id":1},
{"day_id":30,"color_id":1},
{"day_id":31,"color_id":1}]}
Each day has a particular colour to show on the calender. colour_id 1 -red,2-green and 3-yellow.
I can change the
- (NSArray*)calendarMonthView:(TKCalendarMonthView *)monthView marksFromDate:(NSDate *)startDate toDate:(NSDate *)lastDate
by giving dates with the colour id. My problem is how can I change the select image in Tapkucalenderby checking the colour_id coming along with a particular date.
This is what I need to do with my TapkuCalender

jFreeChart: DateAxis to behave like a CategoryAxis. Only discrete datevalues to be printed

I have a TimeSeries Chart with a XYdataset which has the milliseconds of each dates.
Now I want to have a chart that only displays each date one time on the axis, no matter what the range of dates is. I already got it so far, that only the date is printed, not the time (via setNumberFormatOverride() method).
What I have now, is this:
alt text http://dl.getdropbox.com/u/1144075/Bildschirmfoto%202010-08-05%20um%2016.51.39.JPG
What I want, is this:
alt text http://dl.getdropbox.com/u/1144075/Bildschirmfoto%202010-08-05%20um%2016.54.54.JPG
This is a snippet of my code. also, the setLabelAngle() method don't work?!
JFreeChart chart = ChartFactory.createTimeSeriesChart(...);
XYPlot xyplot = (XYPlot)chart.getPlot();
DateAxis dateaxis = (DateAxis) xyplot.getDomainAxis();
dateaxis.setLabelAngle(Math.PI / 6.0);`
numberaxis.setNumberFormatOverride((DecimalFormat)DecimalFormat.getInstance(Locale.GERMAN));
You can set the TickUnit to any convenient DateTickUnitType. I use DAY in this example and MMM to verify the Locale:
axis.setTickUnit(new DateTickUnit(DateTickUnitType.DAY, 1,
new SimpleDateFormat("dd.MMM.yy", Locale.GERMAN)));
As you are a returning customer, I'll address the second question, too: setLabelAngle() works perfectly well, but it changes the axis label in the chart legend. Using setVerticalTickLabels() is an alternative for the tick labels themselves:
axis.setVerticalTickLabels(true);

Resources