2017-03-14 2 views
0

私は大きな初期の選択されたパラメータを使用してAPIをフィルタリングし、テーブル集約(.Rdataにダンプ)することができます。タフになるだろう、しかし、これは(partitionFiltered()に貼り付けるために私を求めて抵抗しよう)グループ化し、関心の私のメトリックをsummmingされる関数である再現性の例にこのすべてをフィッティング:結局反応性のあるオブジェクト要素にハイハットの美しさをマッピングするのに問題がある

df <- reactive({partitionFiltered() %>% 
     dplyr::group_by(updatedTimeHour, direction) %>% 
     dplyr::mutate(count_dir = sum(n_flows)) %>% 
     dplyr::ungroup() %>% 
     dplyr::select(updatedTimeHour, direction, count_dir) %>% 
     dplyr::arrange(updatedTimeHour) %>% 
     unique()}) 

(、 updatedTimeHourdirectionは、それぞれ、input$periodicityinput$dimensionに置き換えられますが、それはこの質問の範囲を超えている)

df()オブジェクトは、次のようになります。

updatedTimeHour direction count_dir 
6    1   525071.00 
6    2   3491.00 
6    0   498816.00 
6    3   5374.00 
7    2   2432.00 
7    0   303818.00 
7    1   340768.00 
7    3   4852.00 
8    1   1969048.00 
あなたはおそらく言うことができるように

 hc <- highchart() %>% 
       hc_add_series(data = df()$count_dir, 
       type = input$plot_type, 
       name = factor(df()$direction) 
       showInLegend = TRUE, 
       # ??group = df()$direction, 
       # ??color = df()$direction, 
       # ??x = df()$updatedTimeHour, y = df()$count_dir, color = df()$direction, 
       # ??hcaes(x = df()$updatedTimeHour, y = df()$count_dir, color = df()$direction) 
      ) %>% 
       hc_xAxis(type = 'datetime', 
         # ??group = factor(df()$direction), 
         categories = df()$updatedTimeHour, 
         tickmarkPlacement = "on", 
         opposite = FALSE) %>% 
       hc_title(text = "NetFlows, by Hour", 
         style = list(fontWeight = "bold")) %>% 
       hc_exporting(enabled = TRUE, filename = "threat_extract") 

No groups or colors mapped to the 4 direction levels

は、私がマップする方法どこ/について非常に混乱しています:の

マイhighcharterコールは、私が期待としてグループ化し、美学を着色していないようですxグループ化udpatedTimeHour、または異なるdirectionレベルの色を適切に設定し、そのgroupが凡例とホバーのラベルに正しくマップされるようにします。

また、私はドキュメントの一部でhc_add_series()への引数として含まれていますが、私は(もはや?)その引数がないことを言っているに名付けスローされたエラーを見るhcaes()コールを使用して、これらの美学をマップしようとしてきたhc_関数...

何か助けていただきありがとうございます。関連する質問はhereです。

答えて

2

複数のオブジェクトを1つのシリーズとして追加しようとしていますが、その理由は機能していません。ただ、それが動作するはずですあなたのコードを少し変更し、「魔法」機能hchartを使用して:

df = data_frame(updatedTimeHour = c(6,6,6,6,7,7,7,7,8), direction = c(1,2,0,3,2,0,1,3,1), count_dir = rnorm(9)) 
type = "line" 
hchart(df, type, hcaes(x = updatedTimeHour, y = count_dir, group = as.factor(direction))) %>% 
    hc_title(text = "NetFlows, by Hour", 
     style = list(fontWeight = "bold")) %>% 
    hc_exporting(enabled = TRUE, filename = "threat_extract") 

enter image description here

+0

あなた、先生は、男です。私は私の問題の大部分が私がdfを作る反応を扱っていたと思っていたと思うが、私はこの作品も必要とした。 – d8aninja

関連する問題