GithubHelp home page GithubHelp logo

recharts's Introduction

recharts

Build Status

This is a prototype of porting Apache ECharts (incubating) into R using htmlwidgets. I only spent a few days on it last year, and I hope more R users can contribute to it. To install this package (please use R >= 3.2.0):

install.packages(
  'recharts',
  repos = c('http://yihui.name/xran', 'http://cran.rstudio.com')
)

Some "hello world" examples:

library(recharts)
echart(iris, ~Sepal.Length, ~Sepal.Width)
echart(iris, ~Sepal.Length, ~Sepal.Width, series = ~Species)

See https://github.com/taiyun/recharts for a similar project that we worked on before. Without the blessings of htmlwidgets, it is much more difficult to maintain that project. I hope this one can grow into a truly nice and exciting package. See the package website http://yihui.name/recharts for more information if you want to contribute.

recharts's People

Contributors

hansz00 avatar yihui 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  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  avatar  avatar  avatar  avatar

Watchers

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

recharts's Issues

Chinese garbled in recharts

hiyihui,
初次接触recharts这个强大的画图包,使用中遇到一些疑问,想请教下。盼解惑,非常感谢

1、使用echart()画出的图形中文显示均为乱码(完全使用 echart(chordEx1) 示例代码,只是将其中的部分英文改成中文)。我使用的R版本为64位3.2.2,图形结果显示在chrome浏览器里(结果链接粘到IE-8,图中的中文也还是乱码,初步排除是浏览器的原因)。

2、echart官网上各种图的OPTION数据代码都是json格式的数据,每次都要手动改成R代码才可以在R中运行么?有没有什么函数可以快速转换为R的格式?

下附 您的echart(chordEx1)示例图(中文非乱码)和我的测试图(中文乱码):
Uploading example.png…
Uploading test.png…

bar plot parameters

以堆叠的条形图为例:
http://echarts.baidu.com/doc/example/bar4.html

可以往series里面加的有stack, itemStyle, barGap, barCategoryGap等等。基本就是说这些bar怎么排列组合,标签怎么弄,柱子宽度高度什么的。

    series : [
        {
            name:'直接访问',
            type:'bar',
            stack: '总量',
            itemStyle : { normal: {label : {show: true, position: 'insideRight'}}},
            data:[320, 302, 301, 334, 390, 330, 320]
        },
        {
            name:'邮件营销',
            type:'bar',
            stack: '总量',
            itemStyle : { normal: {label : {show: true, position: 'insideRight'}}},
            data:[120, 132, 101, 134, 90, 230, 210]
        },
        {
            name:'联盟广告',
            type:'bar',
            stack: '总量',
            itemStyle : { normal: {label : {show: true, position: 'insideRight'}}},
            data:[220, 182, 191, 234, 290, 330, 310]
        },
        {
            name:'视频广告',
            type:'bar',
            stack: '总量',
            itemStyle : { normal: {label : {show: true, position: 'insideRight'}}},
            data:[150, 212, 201, 154, 190, 330, 410]
        },
        {
            name:'搜索引擎',
            type:'bar',
            stack: '总量',
            itemStyle : { normal: {label : {show: true, position: 'insideRight'}}},
            data:[820, 832, 901, 934, 1290, 1330, 1320]
        }
    ]

你觉得怎么放进来比较合适?data_bar()还是拎另外一个函数出来?

Echart3

Hi!

Is this package still under dev ? Echart 3 is now out and seems very nice :)
Is this package will use it ?

Thanks!

Combining reCharts with shiny

In the server function, I cannot add the customize the input. My server function is as below:

server <- shinyServer( function(input, output) { output$scatterplot <- renderEChart({echartr(movies, x = input$x, y = input$y, type = 'point')}) } )

However, when I use ShinyApp, it keeps telling me object 'input' not found.

file("") only supports open = "w+" and open = "w+b"

Get this error in Rstudio.

> echart(iris, ~ Sepal.Length, ~ Sepal.Width)
Warning message:
In file(con, "r") :
  file("") only supports open = "w+" and open = "w+b": using the former

It works in Rgui(open in a external browser). I've tried another package leaflet, it works in Rstudio. So I have no idea where this warning come from.

Tool tip of K plot

Hello Yihui,

I'm trying to create K plot, but I can't let tool tip popup correctly. I think it's something wrong with JavaScript. Can you help me fix it up?

test=rbind( c(2320.26,2302.6,2287.3,2362.94),
            c(2300,2291.3,2288.26,2308.38),
            c(2295.35,2346.5,2295.35,2346.92),
            c(2347.22,2358.98,2337.35,2363.8))
names(test)=c('open', 'close', 'high', 'low')
K1 = list(
  title = list(
    text = 'test',
    subtext = 'From d3.js',
    x = 'right',
    y = 'bottom'
  ),

  tooltip = list(
    trigger = 'item',

# Something wrong here!!!
    formatter = JS("function (params) {
            var res = params[0].seriesName + ' ' + params[0].name;
            res += 'open : ' + params[0].value[0] + '  high : ' + params[0].value[3];
                   res += ' close : ' + params[0].value[1] + '  low : ' + params[0].value[2];
                   return res;
                   }")
  ),
  toolbox = list(
    show = TRUE,
    feature = list(
      restore = list(show = TRUE),
      saveAsImage = list(show = TRUE)
    )
  ),
  dataZoom =list(
    show =TRUE,
    realtime=TRUE,
    start = 50,
    end = 100
  ),
  xAxis=list(
    type = 'category',
    boundaryGap = TRUE,
    axisTick=list( onGap=FALSE),
    splitLine=list(show=FALSE),
    data =c(
      "2013/1/24", "2013/1/25", "2013/1/28", "2013/1/29"
    )
  ),
  yAxis =list(
    type='value',
    scale=TRUE,
    boundaryGap=c(0.01, 0.01)
    ),
  series = list(
    list(
      type = 'k',
      name = c('open','close','high','low'),
      data = test
    )))

echart(K1)

could not find function "renderEcharts"

您好:

我使用如下命令进行安装recharts,install.packages('recharts',repos = c('http://yihui.name/xran', 'http://cran.rstudio.com'))。安装完毕之后在Rstudio中显示的版本是0.0.1。
当我运行https://github.com/taiyun/recharts/tree/master/inst/shiny/recharts_shiny_eForce这个网页中的例子时,提示错误“ERROR: could not find function "recharts.shiny.init"”。当不执行命令行“includeHTML(recharts.shiny.init()),”时,提示错误为“Error in (structure(function (input, output) :
could not find function "renderEcharts"“。

我使用的R版本为3.2.2,win7系统64位。

希望您能够帮我解决这个问题,谢谢~

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.