Giter Site home page Giter Site logo

ramcharts's People

Contributors

bthieurmel avatar julienbretteville avatar mattdowle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ramcharts's Issues

Retain chart settings when changing chart parameters from UI

I have an amStockChart containing 3 time series. During initialization, only the first time series is visible. Now, using the DataSelector list box in the UI, i selected the remaining two series for comparison. Now I used a checkboxinput in the UI to change the scale from normal to logarithmic. The chart refreshes and 2/3 time series get deselected. How can I retain the initial settings in the chart prior to such events invoked by a user in the UI. I am assuming I should use validateNow() method but not sure how and where to invoke it in my shiny code. A working example would be much appreciated

Thank you

[Question] How to override a variable created by a mouseclick event

I'm using a mouse click listener like below
addListener(name = 'clickGraphItem', expression = paste0('function(event){',
'Shiny.onInputChange('clickedVal', event.item.category)',
'}'))

However, there are cases that I need to reset input$clickedVal to '' or NULL. Shiny won't allow me to modify the input value directly. Is there anything can be done to reset the listener?

detailed case
listener is based on chart 1.
clicked value is one of the inputs for chart 2, act as a filter.
if the dataprovider chart 1 is updated, the listener should be reset to NULL, which disables chart 2, as previously clicked value is no longer valid.

Thanks.

Responsive = TRUE

I would like to make my amCharts responsive to smaller screens.

Example: http://codepen.io/amcharts/pen/QwgEKQ/

When I use the R equivalent of it "setResponsive(enabled=TRUE)", it throws an error

Error in : unable to find an inherited method for function ‘setResponsive’ for signature ‘"AmStockChart", "logical"’

Wonder where did I go wrong

zoomOutOnDataUpdate = FALSE example

Hi,
What am I trying to achieve here? I want the charts to render as fast as they can. So I load limited data (monthly) in the first instance. Now when user zooms in (say a period of last 60 days), I use the zoom event listener to trigger an R script which will now load the daily data for that period. Now this time, with new 60 day daily data + previous monthly data (this is needed to make sure user can zoom-out), the chart gets re-rendered but I would need it to retain the "zoomed- in" period (last 60 days window) so that user gets to see the zoomed in period only with the daily data.

I am going by the thread amcharts/amcharts3#26.

AmCharts team gave me the solution to use zoomOutOnDataUpdate = FALSE.

I am unable to make zoomOutOnDataUpdate = FALSE in shiny. Can you give me an example where the zoom period remains constant when we change the data in the dataSets.

[Question] AddListener

Hi,

could you provide an example on assigning a value from the listened event to a session variable on shiny? The purpose is to enable cross filtering or drill down.

Thanks,

AddListener not responding

Hi,

I am trying to kind of replicate the example "http://www.amcharts.com/tips/dynamically-changing-granularity-data-based-zoom-scope/"

I have two dataSets - dataSets_Daily and dataSets_Monthly. I want the monthly to be loaded first and then when zoomed, the daily should get loaded. The following listener code is not responding

addListener('zoomed' , 'function(event){chart.dataSets = dataSets_Price;chart.validateNow(false, true);}'),

Please suggest where am I going wrong here

Thank you as always
SD

Bug with Latest version of rAmCharts

In the latest version of rAmChart (post v1.1.3), data frame containing column headers with special character or numbers are not rendered. It worked fine in v1.1.3

Example , if I change the data frame column name from runExamples() and introduce a space " ", the chart does not render. Please help me resolve this bug in the package

 ## 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
     colnames(times)[2]<-"20 Micron"
#     dummy1<<-times

    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
    graph<-pipeR::pipeline(
      amStockChart(dataDateFormat = 'YYYY-MM-DD JJ:NN:ss') ,
      addDataSet(pipeR::pipeline(
        dataSet(title = 'first data set', categoryField = 'times') ,
        setDataProvider(times,keepNA=FALSE),
        addFieldMapping(fromField = colnames(times)[2], toField = colnames(times)[2]))),
      addPanel(pipeR::pipeline(
        stockPanel(showCategoryAxis = TRUE, title = 'Value') ,
        addStockGraph(id = 'g1',connect=FALSE, valueField = colnames(times)[2], comparable = TRUE,periodValue = 'Average',type='column',
                      compareField = colnames(times)[2], 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')
    )

amPlot formula option

amPlot(Petal.Length + Sepal.Length ~ Sepal.Width, data = iris, legend = TRUE, zoom = TRUE)

the code in amPlot.Rd leads to a wrong legend name and value of that legend is missing.
image

Add series to an rAmCharts using a loop

Hi:

I would like to dynamically add the numbers of series to an rAmchart based on user input. How can I achieve the same.
Data Table a has n number of columns and I would like each column to represent a line series
Working example below is not working:
"fdyG1"= pipeR::pipeline(
amSerialChart(addClassNames = TRUE, autoMargins = FALSE,
marginLeft = 30, marginRight = 8,
marginTop = 10, marginBottom = 26, startDuration = 1,
categoryField = 'PERIOD', startDuration = 0),
addGraph(bullet = 'round', lineThickness = 3,
bulletSize = 7, bulletBorderAlpha = 1, bulletColor = '#FFFFFF',
useLineColorForBulletBorder = TRUE, bulletBorderThickness = 3,
fillAlphas = 0, lineAlpha = 1, title = colnames(a)[2], valueField = colnames(a)[2],
balloonText = balloonText),
setDataProvider(dataProvider = a)
)

      for (ctr in 3:NROW(a)){
        "fdyG1"= pipeR::pipeline(fdyG1,addGraph(bullet = 'round', lineThickness = 3,
                                                bulletSize = 7, bulletBorderAlpha = 1, bulletColor = '#FFFFFF',
                                                useLineColorForBulletBorder = TRUE, bulletBorderThickness = 3, 
                                                fillAlphas = 0, lineAlpha = 1, title = colnames(a)[ctr], valueField = colnames(a)[ctr],
                                                balloonText = balloonText),
                                 setDataProvider(dataProvider = a)
                                )
      }

Using rAmCharts with Flex Dashboard

I try to use rAmCharts with FlexDashboard from RStudio (http://rstudio.github.io/flexdashboard/using.html)

I played around with the layout and it seems to me that rAmCharts could not auto re-size the chart to fit the size of the dashboard.

Is there anything I could do to fix the issue?


title: "Demo of Flex Dashboard from RStudio"
output:
flexdashboard::flex_dashboard:
orientation: columns

vertical_layout: fill

# Load packages and initialize data here
library(flexdashboard)
library(pipeR)
library(rAmCharts)

Column

Angular Gauge

bands <- data.frame(start = c(0, 40, 60), end = c(40, 60, 100), 
                   color = c("#00CC00", "#ffac29", "#ea3838"),
                   stringsAsFactors = FALSE)
bands2 <- data.frame(start = c(100, 130, 170), end = c(130, 170, 200), 
                   color = c("#00CC00", "#ffac29", "#ea3838"),
                   stringsAsFactors = FALSE)
amAngularGauge(x = 25, start = 0, end = 100, bands = bands,
               secondAxe = TRUE, start2 = 100, end2 = 200, bands2 = bands2)

3D Bar plot

data("data_bar")
amBarplot(x = "country", y = "visits", data = data_bar, horiz = TRUE, depth = 15)

Column

Pie chart

data("data_pie")
amPie(data = data_pie) %>>% 
  amOptions(legend = TRUE)

Chart D

data <- data.frame(label = c("A", "Z", "E", "R", "T"),
                   Product1 = c(1, 2, 3, 4, 2), 
                   Product2 = c(2, 8, 1, 1, 0),
                   Product3 = c(1,1,2,2,4))
amRadar(data = data,  pch = "bubble", backTransparency = 0) %>>% 
  amOptions(legend = TRUE, legendPosition = "left")

Is there an example of amStockChart?

Hello, I have been trying to use amStockChart, but no success so far. It ends up printing data to the screen, rather than charting. Haven't spent too much time on it, but is there an example to follow for this function?

Thanks in advance

AmStockCharts Features - Formatting Queries

Hi Jeff,

I would like to know the following:

  1. How to include a background label like a watermark in a AmStockChart like below:
    http://www.amcharts.com/tips/watermark-stock-panels/
    I tried with allLabels but it did not work
  2. If I have data like below, the charts sees NA or NaN as zero value distorting my comparative charts. How can I make the chart see Na or NaN as just a missing value and connect data points

Data Frame:

Period Value1 Value2
2010-01-01 30 NaN
2010-06-01 NaN 67
2010-09-01 45 NaN
2011-03-31 NaN 34
and so on

  1. How to invoke zoom and other custom Javascript functions like the below within R
    https://www.amcharts.com/tips/export-chart-data-to-json-csv-and-excel-via-api/

Apologies for so many queries regarding amStockCharts. Thank you

Asynchronous Loading of Data

Hi,

Native Amcharts allow asynchronous loading of data using the dataloader pluggin (async=TRUE). Since rAmCharts does not use the data loader pluggin, how can we build this effect in our shinyapp?

This will be a great boon to apps using a lot of data as the user will not have to wait until the entire data gets loaded

Thank you as always for all your help so far.

SD

How to use the WordPress Pluggin

Hi,

I would like to use the WordPress Pluggin so that my users can copy the charts and use it in their blogs. How can I implement the same. Can you please create an example of such a functionality

Thank you
SD

amRadar does not take dbl ?

Hi,

It's a bit strange to me that the amRadar does not take dbl as input for columns other than label. Is this intentional? What's the suggested data format then?

Error in amRadar(.) : All column of data except label must be numeric

rAmcharts Package Documentation Queries

Your package manual/documentation rAmcharts.pdf provides below language

"chartScrollbarSettings
ChartScrollbar. If you change a property after the chart is initialized, you should
call stockChart.validateNow() method in order for it to work. If there is no
default value specified, default value of ChartScrollbar class will be used"

I would like to see the validateNow() method being triggered in an example. Usage of validateNow() and validateData() methods is probably the most important part of the package that I am missing today as I enter the final stages of my webapp development.

I have implemented it within an amChart "event" [panelRemoved event] using addListener.

The below works perfectly - I had two panels in my chart. I tried to change the chart type of the first panel stockGraph from line to column using the validateNow() method when user tries to close the second panel. I simple wanted to see if validateNow() method works and it does.

addListener('panelRemoved', 'function(event){
event.chart.panels[0].stockGraphs[0].type = "column";
event.chart.validateNow();
}')

But I really need to be able to call this method anytime based on R events and not just amCharts events. When I say R events, I am referring to say the click of an actionbutton within ui.R. Does the below work for you?

ui.R

actionbutton("samplebtn", label="Click Me"),

amChartsOutput("pic", type = NULL, width = "100%", height = "400px")

server.R

output$pic<-renderAmCharts({

stockChart<<-pipeR::pipeline(
amSerialChart(dataDateFormat = 'YYYY',categoryField = 'year', startDuration = 0),
setDataProvider(data.frame(year = 1990:2015, value = runif(length(1990:2015), -1, 1))),
addValueAxes(axisAlpha = 0, position = 'left'),
addGraph(id = 'g1', type = 'column', valueField = 'value', fillAlphas = 1),
setCategoryAxis(minPeriod = 'YYYY', parseDates = TRUE),
addListener('init', paste('function(event) {',
'setTimeout(function() {',
' event.chart.allLabels = [{',
' x: event.chart.marginLeftReal + 20,',
' y: event.chart.marginTopReal + 20,',
' text: "Watermark label",',
' size: 20,',
' color: "green",',
' alpha: 1',
' }];',
' event.chart.validateNow()',
'}, 100)}'))
)

return(plot(chart))
})

shinyjs::onclick("samplebtn", stockChart.validateNow())

######### Or you could Use

observeEvent(input$samplebtn,{

Change some chart property here

.....
.....

Now validate the chart

stockChart.validateNow()
})

Thank you for your cooperation and I am willing to bring ideas to the table,if needed, to implement it.

Thank you as always
SD

[Question] How to manipulate the data in JS portion of setLegend

Hi,

I have the below settings for legend. However because the value is too big, I'd like to divide it by 1,000 or 1,000,000 and round it.
I have tried [[ Math.round(value.sum/1000)]] but it didn't work.
Also, is it possible to do if/else clause inside the [[ ]]?
Thanks.

setLegend(position = 'bottom' ,useGraphSettings = TRUE, periodValueText = ' {[[value.sum]]}', valueWidth = 80) %>%

amRadar legend = T/F function not working?

Hi,

Can you double check if this switch is working or not?

In addition, is it possible to change the position and layout of legend? for example, put it on left/right side vertically. like the one implemented in visNetwork.

Thanks.

other chart type does not take dbl except for amRadar

referencing
#11

Hi,

It seems when I use the complex function, the dataProvider has to be data frame class.
If I feed in a tbl_df object without the as.data.frame(), below error msg will show up.

amSerialChart(graphs = graphs_ls, theme = 'light',categoryField = 'Week') %>%
setDataProvider(dataProvider = dat)

Warning: Error in : unable to find an inherited method for function ‘setDataProvider’ for signature ‘"AmChart", "tbl_df", "missing"’
Stack trace (innermost first):

[Feature Request] More flexibility in amCandlestick x-axis

Hi,

I'm experimenting to use candlestick diagram to visualize some weekly dataset (non-stock related)
Is it possible to make the date column to a sorted vector or something like that type?

for example, the category I am using is like '2016W01, 2016W02, .....'

Thanks

[Enhancement] Convert factor column into character column by default

Hi,

While it's doable outside of the amFunctions, it might just be easier to implement inside them.
Would amFunction be able to take both character and factor columns in x-axis?

Example error code

Error in amBarplot(x = c("Quarter"), y = nms, data = dat, labelRotation = 90, :
The column Quarter of the dataframe must be character.

some issue with the input type for mainSize parameter

Hi,

I was trying to make this parameter dynamic by changing it with the # of axis on radar map

fontSize <- max(as.integer(16 / (log(nrow(dat))+1)),8L)
amRadar(dat, mainSize = fontSize,legend = FALSE)

But somehow it throws an error below
Error in amRadar(dat, mainSize = fontSize) :
mainSize must be a numeric or double

Save AmCharts into the server as a PNG file

AmCharts gives an example of how to do it here:
http://extra.amcharts.com/tutorials/save-on-server/
https://www.amcharts.com/tutorials/saving-exported-chart-image-server/

I am able to get the JS and R part right. So running below code saves the base64 onto the console.

exportMenu<-c(Draw,list(DownloadAs),list(SaveAs),list(PRINT),list(list(label="Share",click=htmlwidgets::JS('function () {
alert( "Clicked JPEG. Wow cool!" );
this.capture( {}, function() {
this.toJPG( {}, function( base64 ) {
console.log(base64)
} );
} );
}')
)))

Now the tutorial says I must create a php file and I have no clue about php. So, I create the save.php file within rStudio directory where my ui.R and server.R files are. I type the below code in that file

Finally when I run the program, the base64 URI data gets logged onto the console but does not save the png file in my server path.

I am seeking your help in case there is someone in your team who understand php and how this should work. Thank you as always

SD

Example of usage of StockEvents

Can you please provide an example where StockEvents feature has been used. My current attempts to use StockEvents is giving a blank screen.

A working example is highly appreciated.

Thank you
SD

AmStockChart excel download

Hi,

When I use the setExport feature to extract the data associated with an AmStockChart in an excel format or any other format, the file name is always "AmCharts". Can I configure the settings to change the filename?

Regards,
SD

Guidelines in AmStockChart

Hi,

Apologies for opening another issue in such short duration.

I am unable to create Guidelines in a AmStockChart. I used the shiny example of an AmSerialChart with guidelines in it but could not reproduce it in AmStockChart. I played with both setGuides and addGuide functions but got error messages in both cases

addGuide(category = '2001', toCategory = '2003',
lineColor = '#CC0000', lineAlpha = 1, fillAlpha = 0.2,
fillColor = '#CC0000', dashLength = 2, inside = TRUE,
labelRotation = 90, label = 'fines for speeding increased')

Error: unable to find an inherited method for function ‘addGuide’ for signature ‘"AmStockChart", "missing"’

Thanks

Theme: Patterns does not work in shinyserver (shinyapps.io)

Hi,

The theme patterns does not work in shinyserver (shinyapps.io).

Also was curious to see if there is a theme called "black" available. I could see js file inside the package but when I tried theme="black", I got an error so not sure

PS: I am using stockchart

Warning messages in v2.0.0

I get the following new warning messages in v2.0.0
Warning in FUN(X[[i]], ...) :
You should use setter for property 'creditsPosition'
Warning in FUN(X[[i]], ...) :
You should use setter for property 'allLabels'

How to fix these?

Issues in latest CRAN version of rAmCharts

Latest version of rAmCharts was installed from CRAN and now some of the features do not function anymore.

For example,

  1. When we run runExamples(), we get following error
    Error in shiny::shinyAppDir(appDir = "./inst/shiny/") :
    No Shiny application exists at the path "./inst/shiny/"
  2. AddListener is working for zoomed event but not for rendered event.
    example: AddListener('zoomed','function(event){alert ("Hello"); }') is working but
    AddListener('rendered','function(event){alert ("Hello"); }') is not working
  3. Not compatible with shinyjs package in R. This was not an issue with version 1.1.2. My shinyapp used a devtool version of the package downloaded back in Nov-Dec'2015 and that was almost perfect but now the latest devtool version is almost same as the CRAN version and has the same issues.
  4. Rendering of AmStockCharts in general is taking ages.

Wrong legend color for one dimension group

Data
Quarter QTY
Y16Q01 8000
amBarplot(x=c('Quarter'),y= 'QTY', data = dat, groups_color = '#00A73C') %>% amOptions(legend = TRUE)
image

I don't know if it's happening in other chart types, but it's wrong in barplot.
In addition, when you hover over the bar, the group name (supposedly QTY) is missing.

[Enhancement] Allow user to define precision on final output

Hi,

I'm experimenting candlestick chart. When user hover over the chart to see detailed number, I'd like to limit the precision to be 0 digits, instead of 2.

Can this be done as a parameter for candlestick and possibly other charts?

Thanks.

license and no attribution

rAmCharts is wonderful, but now that it is official on CRAN, I am quite surprised that there is no attribution for AmCharts in the DESCRIPTION, and no mention of commercial license options. At a minimum I would have expected based on CRAN policies, something like these lines from visNetwork or as another example taucharts. It seems well worth a link to the commercial license options http://www.amcharts.com/online-store/ in DESCRIPTION/DESCRIPTION.

I'm very sensitive to this since htmlwidgets depend so much on the hard work of the JavaScript developers, and I try to err on the side of over-attribution and over-disclosure.

Thanks so much for your work on visNetwork and rAmCharts. They really are well designed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.