I'll show you how the ccharter
function can be integrated in a KNIME workflow. This is a work in progress, currently will require a bit of tweaking to make it work with your dataset.
We'll be using use the nodes in the picture below for this example.
Ensure you have installed the ccharter
package in R and that KNIME uses your own R installation
In a new KNIME workflow, create an R Source (Table) node. Press F6 to configure the node.
set.seed(154)
time.series <- data.frame(t.dates = seq.Date(as.Date("2014-02-01"), as.Date("2016-08-01"), "month"),
t.values = c(
seq(0.1, 0.8, by = 0.1) * runif(8) + 3,
seq(0.1, 0.7, by = 0.1) * runif(7) + 4,
seq(0.1, 0.7, by = 0.1) * runif(7) + 5,
seq(0.1, 0.4, by = 0.1) * runif(4) + 4,
seq(0.1, 0.5, by = 0.1) * runif(5) + 4)
)
time.series$t.dates <- as.character(time.series$t.dates)
knime.out <- time.series # assign your data frame here
ccharter
librarylibrary(ccharter)
knime.in$"t.dates" <- as.Date(knime.in$"t.dates")
control.chart.data <- ccpoints(knime.in, "t.dates", "t.values")
control.chart.data[["data"]]$t.dates <- as.character(control.chart.data[["data"]]$t.dates)
knime.out <- control.chart.data[["data"]]
library(ggplot2)
library(scales)
knime.in$"t.dates" <- as.Date(knime.in$"t.dates")
g <- ggplot(knime.in, aes(x = t.dates))
g <- g + geom_line(aes(y = data.mean), size = 1.2, color = "darkorange")
g <- g + geom_line(aes(y = data.ll), size = 1.2, color = "steelblue")
g <- g + geom_line(aes(y = data.ul), size = 1.2, color = "steelblue")
g <- g + geom_line(aes(y = t.values), size=0.6, color = "gray44")
g <- g + geom_point(aes(y = t.values), color = "midnightblue")
g <- g + theme_bw()
g <- g + scale_x_date(labels = date_format("%b/%y"), minor_breaks = NULL, breaks = date_breaks("month"))
g <- g + theme(axis.text.x = element_text(angle = 90, hjust = 1))
g <- g + labs(x = "Month")
g <- g + theme(plot.title = element_text(hjust = 0))
print(g)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.