Closed debsush closed 8 years ago
Thanks for your feedback.
The runExamples
bug is already fix.
Can you send us simple examples for the others ?
We'll try to correct, and push a new version as quickly as possible.
Concerning rendered
listener, this example work for me (with and without shiny) :
require(rAmCharts)
server <- function(input, output) {
output$distPlot <- renderAmCharts({
data("data_pie")
amPie(data = data_pie, show_values = FALSE) %>>%
addListener('rendered','function(event){alert ("Hello"); }')
})
}
ui <- fluidPage(
amChartsOutput("distPlot")
)
shinyApp(ui = ui, server = server)
No the runExamples() is not yet fixed. Now I get the following error runExamples() gives error below "rror: unexpected input in "runExamples() rAmCharts::runExamples() gives below error Error in shiny::shinyAppDir(appDir = "./inst/shiny/") : No Shiny application exists at the path "./inst/shiny/"
Please tell me where can I download the v 1.1.13 of rAmCharts package. It is not available in CRAN archive and my app was built on this version and I am in desperate need of that version. See details of the version below. Please help me
"rAmCharts" : {"Source" : "github",
"Repository" : null,
"GithubRepo" : "rAmCharts",
"GithubUsername" : "dataKnowledge",
"GithubRef" : "master",
"GithubSha1" : "ff6eea1920698fdfbe9c8918942f32d78f54c959",
"description" : {
"Package" : "rAmCharts",
"Title" : "JavaScript Charts API Tool",
"Description" : "API for using 'AmCharts' Library. Based on the 'htmlwidgets'\n package, it provides a global architecture to generate 'JavaScript' source\n code for charts. Most of classes in the library have their equivalent in R\n with S4 classes; for those classes, not all properties have been referenced\n but can easily be added in the constructors. Complex properties (e.g.\n 'JavaScript' object) can be passed as named list. See examples at <http://\n
dataknowledge.github.io/rAmCharts/>. and <http://www.amcharts.com/> for\n
more information about the library. The package includes the free version of\n 'AmCharts' Library.
Its only limitation is that a small link to the web site\n will be displayed in your charts.
If you enjoy this library, do not hesitate\n to refer to this page <http://www.amcharts.com/online-store/> to purchase a\n licence, and thus support its creators and get a period of Priority Support.\n
See also <http://www.amcharts.com/about/> for more information about\n 'AmCharts' company.",
"Version" : "1.1.3",
"Authors@R" : "c(\n person(given = \"Jeffery\", family = \"Petit\", email = \"jeff@datak.fr\", role = c(\"aut\", \"cre\")),\n
person(given = \"Antanas\", family = \" Marcelionis\", role = c(\"aut\", \"cph\"),\n
comment = \"'AmCharts' library in th directory htmlwidgets/lib/amcharts, refer to http://www.amcharts.com/\"),\n person(given = \"Benoit\", family = \"Thieurmel\", email = \"benoit.thieurmel@datak.fr\", role = c(\"aut\", \"ctb\")),\n
person(family = \"DataKnowledge\", role = c(\"ctb\"),\n comment = \"See official web site at http://www.datak.fr\"))",
"Date" : "2015-10-18", "License" : "GPL (>= 2)", "URL" : "http://dataknowledge.github.io/rAmCharts/", "BugReports" : "https://github.com/DataKnowledge/rAmCharts/issues/",
"Depends" : "\nR (>= 3.2.0)", "Collate" : "\n'AmObject.R'\n'AmBalloon.R'\n'AmChart.R'\n'AmChart_constructors.R'\n'sharedGenerics.R'\n'AxisBase.R'\n'ValueAxis.R'\n'basicClassUnions.R'\n'TrendLine.R'\n'Title.R'\n'StockPanel.R'\n'StockEvent.R'\n'PeriodSelector.R'\n'Label.R'\n'Guide.R'\n'GaugeAxis.R'\n'GaugeBand.R'\n'GaugeArrow.R'\n'DataSet.R'\n'ChartScrollbar.R'\n'ChartCursor.R'\n'AmLegend.R'\n'AmGraph.R'\n'classUnion.R'\n'CategoryAxis.R'\n'AmChart_setters.R'\n'AmChart_shinyUtils.R'\n'AmStockChart.R'\n'AmCharts_plot.R'\n'AmStockChart_setters.R'\n'AxisBase_setters.R'\n'ChartCursor_setters.R'\n'ChartScrollbar_setters.R'\n'DataSetSelector.R'\n'DataSet_setters.R'\n'GaugeArrow_setters.R'\n'GaugeAxis_setters.R'\n'Guide_setters.R'\n'StockEvent_setters.R'\n'StockPanel_setters.R'\n'TrendLine_setters.R'\n'amBoxplot.R'\n'amBulletChart.R'\n'amFunnel.R'\n'amGauge.R'\n'amHist.R'\n'amPlot.R'\n'amWaterfall.R'\n'data.R'\n'shinyExamples.R'\n'startupMessage.R'\n'utils.R'",
"Imports" : "\nmethods,\nhtmlwidgets,\nhtmltools,\nrlist,\ndata.table,\ngraphics,\nutils,\npipeR", "Suggests" : "\nmagrittr,\nshiny,\ntestthat", "RemoteType" : "github", "RemoteHost" : "api.github.com", "RemoteRepo" : "rAmCharts", "RemoteUsername" : "dataKnowledge",
"RemoteRef" : "master",
"RemoteSha" : "ff6eea1920698fdfbe9c8918942f32d78f54c959",
"GithubRepo" : "rAmCharts",
"GithubUsername" : "dataKnowledge",
"GithubRef" : "master",
"GithubSHA1" : "ff6eea1920698fdfbe9c8918942f32d78f54c959",
"Author" : "Jeffery Petit [aut, cre],\n Antanas Marcelionis [aut, cph]('AmCharts' library in th directoryn htmlwidgets/lib/amcharts, refer to http://www.amcharts.com/),\n Benoit Thieurmel [aut, ctb],\n DataKnowledge [ctb](See official web site at http://www.datak.fr)", "Maintainer" : "Jeffery Petit jeff@datak.fr", "Built" : "R 3.2.0; ; 2015-12-03 09:33:58 UTC; unix" } },
Hi,
The shiny bug was fix after CRAN submission, so it's ok only with the github version.
For the others points, it's really strange because we worked mainly on simple function amBoxplot
, amBarplot
, .... So for help us, can you send us sessionInfo()
output and simple example with error please ?
Can you try my rendering
example, working well for me ?
Sure I can help with certain examples and let me know if you face the same issues.
First load rAmCharts_v1.1.2 and run the below example. You will see that the rendered event is not dispatched but zoom is. Now load rAmCharts_v2.0.0 and run the examples, you will find that zoom event is dispatched every time rendered event is dispatched. Please let me know if you are seeing the same issue
require(rAmCharts) require(shiny) require(shinyjs) require(pipeR) require(data.table) server <- function(input, output) { output$distPlot <- renderAmCharts({
fieldMappings_ls<<-lapply(2:NCOL(Base), function(i)
list(fromField = colnames(Base)[i], toField = colnames(Base)[i])
)
dataSets_Prices <<- lapply(1:1, function(i)
dataSet(title = "Mains",
categoryField = 'Date',
compared= FALSE,
dataProvider = data.table(Base[,c("Date","Open","High","Low","Close")]),
fieldMappings = fieldMappings_ls)
)
# Prepare your stockgraphs
stockgraphs_Ls <<- stockGraph(id = "Price",
title="Price",
valueAxis = 'v1',
labels = TRUE,
balloonColor="#00000",
comparable=TRUE,
openField="Open",
highField="High",
lowField="Low",
closeField="Close",
valueField="Close",
type= input$trialbtn,
compareGraphType = "line",
compareField = "Close",
compareGraphBullet = 'none',
compareGraphLineThickness = 2,
compareGraphBulletSize = 0,
compareGraphBulletBorderAlpha = 0,
compareGraphUseLineColorForBulletBorder = TRUE,
compareGraphBulletBorderThickness = 0,
compareGraphFillAlphas = 0.1,
compareGraphLineAlpha = 1,
showEventsOnComparedGraphs=TRUE
)
#----------------------------------------------------------------------
stockpanels_Ls <<- lapply(1:1, function(i)
stockPanel(id=paste('fp',i,sep=""),
Title=i,
precision=2,
showCategoryAxis= TRUE,
autoDisplay=FALSE,
allowTurningOff = FALSE,
borderColor = "#ffffff",
columnWidth=.8,
thousandsSeparator=",",
borderAlpha = 1)%>>%
addStockGraph(stockgraphs_Ls)
)
chart <<- pipeR::pipeline(
amStockChart(startDuration = 1,
processTimeout=.01,
theme="light", #--dark, chalk, default
dataDateFormat = "YYYY-MM-DD",
dataSets=dataSets_Prices,
panels=stockpanels_Ls),
addListener('zoomed' , 'function(event){
alert("Zoomed");
}'),
addListener('rendered' , 'function(event) {
alert("Rendered");
}'),
setCategoryAxesSettings(axisAlpha = 0,
equalSpacing = TRUE,
startOnAxis = TRUE,
maxSeries=200,
groupToPeriods = c("MM","YYYY"), #if ((is.null(input$zoomend)==FALSE) && (as.numeric(as.Date(input$zoomend))-as.numeric(as.Date(input$zoomstart))<365)) {"DD"} else {c("MM","YYYY")},
gridAlpha = 0.07,
axisColor = '#DADADA',
axisHeight=25,
inside=FALSE,
tickLength = 0,
gridThickness = 0,
valueLineAlpha = 0.5),
setValueAxesSettings(axisAlpha = 1,
gridAlpha = 0,
tickLength = 1,
gridThickness = 0),
setPanelsSettings(panelSpacing=0), #,zoomOutText= "Show All"),
setChartScrollbarSettings(graph="Volume",
color = "#00000",
height = 30,
updateOnReleaseOnly=TRUE,
graphType= "column",
#usePeriod= "DD",
backgroundColor= "#fff",
graphFillColor= "#191970",
graphFillAlpha= 0.5,
gridColor= "#555",
gridAlpha= 1,
selectedBackgroundColor= "#bddfeb",
selectedGraphFillAlpha= 1),
setChartCursorSettings(valueLineEnabled =TRUE,
valueBalloonsEnabled = TRUE,
valueLineBalloonEnabled= TRUE,
categoryLineEnabled =TRUE,
fullWidth = FALSE,
cursorAlpha = 1,
valueLineAlpha = 1),
setBalloon(gridPosition = "start"),
setPeriodSelector(periodSelector(position = 'bottom',hideOutOfScopePeriods=TRUE)%>>%
addPeriod(period = 'DD', selected = TRUE, count = 5, label = '5D') %>>%
addPeriod(period = 'MM', selected = TRUE, count = 1, label = '1M') %>>%
addPeriod(period = 'MM', selected = TRUE, count = 3, label = '3M') %>>%
addPeriod(period = 'MM', selected = TRUE, count = 6, label = '6M') %>>%
addPeriod(period = 'YYYY', selected = TRUE, count = 1, label = '1Y') %>>%
addPeriod(period = 'YYYY', selected = TRUE, count = 5, label = '5Y') %>>%
addPeriod(period = 'MAX', label = 'MAX'))
)
}) }
ui <- fluidPage( radioButtons("trialbtn", label =NULL, choices = c("Candle"="candlestick", "Bar"="hollow", "Ohlc"="ohlc", "Area" = "smoothedLine", "Line" = "line"), selected = "smoothedLine",inline = TRUE, width = NULL), amChartsOutput("distPlot") )
shinyApp(ui = ui, server = server)
How difficult would it be to upload the v1.1.3 in some repository from where I can download and install it
I am also facing issues with Shiny. For example observeEvent is not responding with the latest version v.2.0.0 but is working fine with v.1.1.2. Very weird and I cannot explain it why. However, in place of observeEvent, if I use shinyjs::onclick, it again works fine.
Wonder if has to do anything with namespace etc. although I am no expert or authority to provide a root cause analysis.
One more query - can you please confirm if the following features work with v1.1.2.
The above two are essential features in my App which I am currently missing. The above 2 features work in v2.0.0 but the problem is that when every time the chart is initialized, first the "zoom" event gets fired and then the "rendered" event. I think this is how it is supposed to work based on what I read in amcharts.com. But you will find that in case of v1.1.2 or v1.1.3, the "zoom" event is not fired every time chart is built. "zoom" event only gets triggered when we explicitly zoom the chart. This is exactly what I want in my App.
Here is my sessionInfo()
sessionInfo() R version 3.2.0 (2015-04-16) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 14.04.2 LTS
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8
[8] LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages: [1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] plyr_1.8.3 PerformanceAnalytics_1.4.3541 reshape2_1.4.1 reshape_0.8.5 shinyjs_0.4.0 htmlwidgets_0.6
[7] pipeR_0.6.1.3 loryR_0.1 stringr_1.0.0 shinyBS_0.62 Quandl_2.7.0 data.table_1.9.6
[13] sm_2.2-5.4 dplyr_0.4.3 quantmod_0.4-5 TTR_0.23-1 xts_0.9-7 zoo_1.7-12
[19] sqldf_0.4-10 RSQLite_1.0.0 gsubfn_0.6-6 proto_0.3-10 shiny_0.13.1 rAmCharts_1.1.2
[25] RMySQL_0.10.8 DBI_0.3.1
loaded via a namespace (and not attached):
[1] Rcpp_0.12.4 base64enc_0.1-3 tools_3.2.0 digest_0.6.9 jsonlite_0.9.19 lattice_0.20-33 curl_0.9.7 yaml_2.1.13 parallel_3.2.0 httr_1.1.0 knitr_1.12.3
[12] DT_0.1.39 grid_3.2.0 R6_2.1.2 tcltk_3.2.0 magrittr_1.5 htmltools_0.3.5 rlist_0.4.6.1 assertthat_0.1 mime_0.4 xtable_1.8-2 httpuv_1.3.3
[23] miniUI_0.1.1 stringi_1.0-1 chron_2.3-47
Concerning zoomed
& rendered
events, you 're right : the process observed in the 2.0.0 is the good with regard to the javascript library. In R, we have corrected the rendered
since 1.1.2 because there was some bug with shiny. So we can't help us on this (because the events occur well when they have to...!)
setExport
work fine in amStockChart in 2.0.0
(not in 1.1.2
). This is some examples :
data('data_stock1')
stock_chart <- pipeR::pipeline(
amStockChart(startDuration = 0),
setExport(),
addDataSet(
pipeR::pipeline(
dataSet(title = 'first data set', categoryField = 'date',
dataProvider = data_stock1$chartData1),
addFieldMapping(fromField = 'value', toField = 'value'),
addFieldMapping(fromField = 'volume', toField = 'volume'))
),
addDataSet(
pipeR::pipeline(dataSet(title = 'second data set', categoryField = 'date',
dataProvider = data_stock1$chartData2),
addFieldMapping(fromField = 'value', toField = 'value'),
addFieldMapping(fromField = 'volume', toField = 'volume'))
),
addDataSet(
pipeR::pipeline(dataSet(title = 'third data set', categoryField = 'date',
dataProvider = data_stock1$chartData3),
addFieldMapping(fromField = 'value', toField = 'value'),
addFieldMapping(fromField = 'volume', toField = 'volume'))
),
addDataSet(
pipeR::pipeline(dataSet(title = 'fourth data set', categoryField = 'date',
dataProvider = data_stock1$chartData4),
addFieldMapping(fromField = 'value', toField = 'value'),
addFieldMapping(fromField = 'volume', toField = 'volume'))
),
addPanel(
pipeR::pipeline(
stockPanel(showCategoryAxis = FALSE, title = 'Value', percentHeight = 70),
addStockGraph(id = 'g1', valueField = 'value', comparable = TRUE,
compareField = 'value', balloonText = '[[title]] =<b>[[value]]</b>',
compareGraphBalloonText = '[[title]] =<b>[[value]]</b>'),
setStockLegend(periodValueTextComparing = '[[percents.value.close]]%',
periodValueTextRegular = '[[value.close]]'))
),
addPanel(
pipeR::pipeline(stockPanel(title = 'Volume', percentHeight = 30),
addStockGraph(valueField = 'volume', type = 'column', fillAlphas = 1),
setStockLegend(periodValueTextRegular = '[[value.close]]'))
),
setChartScrollbarSettings(graph = 'g1'),
setChartCursorSettings(valueBalloonsEnabled = TRUE, fullWidth = TRUE,
cursorAlpha = 0.1, valueLineBalloonEnabled = TRUE,
valueLineEnabled = TRUE, valueLineAlpha = 0.5),
setPeriodSelector(
pipeR::pipeline(periodSelector(position = 'left'),
addPeriod(period = 'DD', selected = TRUE, count = 7, label = '1 week'),
addPeriod(period = 'MAX', label = 'MAX'))
),
setDataSetSelector(position = 'left'),
setPanelsSettings(recalculateToPercents = FALSE)
)
plot(stock_chart)
## Data
times <- as.POSIXct(seq(-60 * 60 * 24 * 50 + 1, 0, by = 3600), origin = Sys.time(), tz = 'UTC')
times <- round(times,'hours')
times <- data.frame(times)
times$Mesure <- 1:length(times$times) + rep(cos(seq(-pi,pi,length.out = 100)), 12) * 500 + runif(length(times$times)) * 200
mycategoryBalloonDateFormat <- list(list(period = 'YYYY', format = 'YYYY'),
list(period='MM', format = 'YYYY-MM'),
list(period = 'WW', format = 'YYYY-MM-DD'),
list(period='DD', format = 'YYYY-MM-DD'),
list(period = 'hh', format = 'YYYY-MM-DD JJ:NN'),
list(period='mm', format = 'YYYY-MM-DD JJ:NN'),
list(period = 'ss', format = 'YYYY-MM-DD JJ:NN:ss'),
list(period='fff', format = 'YYYY-MM-DD JJ:NN:ss'))
## Plot
stock_chart2 <- pipeR::pipeline(
amStockChart(dataDateFormat = 'YYYY-MM-DD JJ:NN:ss') ,
setExport(),
addDataSet(pipeR::pipeline(
dataSet(title = 'first data set', categoryField = 'times') ,
setDataProvider(times,keepNA=FALSE),
addFieldMapping(fromField = 'Mesure', toField = 'Mesure'))),
addPanel(pipeR::pipeline(
stockPanel(showCategoryAxis = TRUE, title = 'Value') ,
addStockGraph(id = 'g1',connect=FALSE, valueField = 'Mesure', comparable = TRUE,periodValue = 'Average',
compareField = 'Mesure', balloonText = 'Value : <b>[[value]] Unit</b>', precision = 0,
compareGraphBalloonText = '[[title]] =<b>[[value]]</b>'))),
setChartScrollbarSettings(graph = 'g1'),
setChartCursorSettings( valueBalloonsEnabled = TRUE, fullWidth = TRUE,
cursorAlpha = 0.1, valueLineBalloonEnabled = TRUE,
valueLineEnabled = TRUE, valueLineAlpha = 0.5,
categoryBalloonDateFormats = mycategoryBalloonDateFormat),
setPeriodSelector(pipeR::pipeline( periodSelector( position = 'bottom' ,inputFieldsEnabled=FALSE) ,
addPeriod( period = 'DD', selected = TRUE, count = 1, label = '1 day') ,
addPeriod( period = 'WW', count = 1, label = '1 week' ) ,
addPeriod( period = 'MAX', label = 'All' ))),
setCategoryAxesSettings(parseDates = TRUE, minPeriod = '1hh',
groupToPeriods = c('hh','3hh', '12hh','1DD'),maxSeries = 50),
setPanelsSettings(recalculateToPercents = 'never', creditsPosition='top-left')
)
plot(stock_chart2)
For some shiny issue, can't help you without example. (We don't have problems with our applications)
So if I am correct from what I understand above, v1.1.2 should be able to fire the rendered event without the zoom event. It is not getting fired at all in my system.
For example, in my system, if I am using v 1.1.2 with the below code, the "zoom" alert pops up when I use the period selector or mouse for zooming, but the "rendered" alert never pops up. How does it behave in your system
chart <<- pipeR::pipeline(
amStockChart(startDuration = 1,
processTimeout=.01,
theme="light", #--dark, chalk, default
dataDateFormat = "YYYY-MM-DD",
dataSets=dataSets_Prices,
panels=stockpanels_Lses),
addListener(name="rendered",expression= "function(event) {
alert('rendered');
}"),
addListener(name="zoomed",expression= "function(event) {
alert('zoomed');
}"),
setCategoryAxesSettings(axisAlpha = 0,
equalSpacing = TRUE,
startOnAxis = TRUE,
maxSeries=240,
groupToPeriods = c("1DD","MM","YYYY"), #if ((is.null(input$zoomend)==FALSE) && (as.numeric(as.Date(input$zoomend))-as.numeric(as.Date(input$zoomstart))<365)) {"DD"} else {c("MM","YYYY")},
gridAlpha = 0.07,
axisColor = '#DADADA',
axisHeight=25,
inside=FALSE,
tickLength = 0,
gridThickness = 0,
valueLineAlpha = 0.5),
setValueAxesSettings(axisAlpha = 1,
gridAlpha = 0,
tickLength = 1,
gridThickness = 0),
setPanelsSettings(panelSpacing=0), #,zoomOutText= "Show All"),
setChartScrollbarSettings(graph="Volume",
color = "#00000",
height = 30,
updateOnReleaseOnly=TRUE,
graphType= "column",
backgroundColor= "#fff",
graphFillColor= "#191970",
graphFillAlpha= 0.5,
gridColor= "#555",
gridAlpha= 1,
selectedBackgroundColor= "#bddfeb",
selectedGraphFillAlpha= 1),
setChartCursorSettings(valueLineEnabled =TRUE,
valueBalloonsEnabled = TRUE,
valueLineBalloonEnabled= TRUE,
categoryLineEnabled =TRUE,
fullWidth = FALSE,
cursorAlpha = 1,
valueLineAlpha = 1),
setBalloon(gridPosition = "start"),
setPeriodSelector(periodSelector(position = 'bottom')%>>%
addPeriod(period = 'DD', selected = TRUE, count = 5, label = '5D') %>>%
addPeriod(period = 'MM', selected = TRUE, count = 1, label = '1M') %>>%
addPeriod(period = 'MM', selected = TRUE, count = 3, label = '3M') %>>%
addPeriod(period = 'MM', selected = TRUE, count = 6, label = '6M') %>>%
addPeriod(period = 'YYYY', selected = TRUE, count = 1, label = '1Y') %>>%
addPeriod(period = 'YYYY', selected = TRUE, count = 5, label = '5Y') %>>%
addPeriod(period = 'MAX', label = 'MAX'))
)
Having said everything, I still feel I would like to re-install my beloved v 1.1.3 once again. How can I do that? It was available in the github_install DataKnowledge repository (dev version) but since that respository has moved, I am unable to find it in the datastorm-open respository. Please please please help me with the version 1.1.3 - I have gone too far down the lane in my development work and cannot reinvent the wheel with v2.0.0 weeks before my launch. Appreciate your support. Thank you as always. SD
Hi,
The 1.1.3
became 2.0.0
for CRAN submission.... but I try to put an older version on our github to help you. You can install it for test with install_github("datastorm-open/rAmCharts", ref = "v1.1.3")
.
However, in the future, I think it's better to use the version 2.0.0, (which has as discussed in reality the good events ...), and on whom we shall continue to work.
We are always curious to have an example of problem with shiny / shinyjs on 2.0.0
if possible.
Many many thanks. I am back in the game; my webapp is working fine now with v1.1.3. If you ever swing by Luxembourg, I will buy you a beer.
As far as testing is concerned, I have v2.0.0 installed in my UAT environment and the v1.1.3 in the dev environment. I will regularly update you on the results
Merci Beaucoup SD
Latest version of rAmCharts was installed from CRAN and now some of the features do not function anymore.
For example,