public static void drawChart(String chartId, String encoded) {
    EntityUser user = Utility.getCurrentUser(session);
    List<ChartDbo> charts = user.getCharts();
    // special case for showing remote pages
    Map<String, String> variables = ChartUtil.decodeVariables(encoded);

    ChartDbo chart = new ChartDbo();
    chart.setChartId(chartId);
    chart.setEncodedVariables(encoded);
    String title = chart.getTitle();
    String url = chart.getLargeChartUrl();
    render(charts, variables, url, title, chartId, encoded);
  }
  public static void addChartToDashboard(String chartId, String encoded) {
    // make sure chart exists...
    ChartUtil.fetchChart(chartId);
    ChartDbo chart = new ChartDbo();
    chart.setChartId(chartId);
    chart.setEncodedVariables(encoded);
    // he could create multiples of the same chart so just timestamp it as he would not
    // be fast enough to create ones with an id clash...
    chart.setId(chartId + System.currentTimeMillis());

    EntityUser user = Utility.getCurrentUser(session);
    List<ChartDbo> charts = user.getCharts();
    charts.add(chart);
    NoSql.em().put(user);
    NoSql.em().flush();

    Settings.charts();
  }