Exemple #1
0
  public String getXYChartCode() {
    xyChartCode = getDataCode();
    xyChartCode += (xAxis.getDateLen() > -1) ? getXTimeScale() : getXLinearScale();
    xyChartCode += getYArea();
    xyChartCode += getSvgRegion();

    xyChartCode += getDomainCode();
    xyChartCode += getAxisCode();
    xyChartCode += getTitleCode();
    xyChartCode +=
        "svg.append(\"g\")"
            + ".attr(\"class\",\"x axis\")"
            + textStyle.getStyles()
            + ".attr(\"transform\", \"translate(0,"
            + getHeight()
            + ")\")"
            + ".call(xAxis);\n";
    xyChartCode +=
        "svg.append(\"text\").attr(\"x\","
            + (getTotalWidth() / 2)
            + ").attr(\"y\","
            + (getHeight() + getBottomMargin())
            + ")"
            + textStyle.getStyles()
            + ".attr(\"text-anchor\", \"middle\").text(\""
            + xAxis.getTitle()
            + "\");\n";
    xyChartCode +=
        "svg.append(\"g\")"
            + ".attr(\"class\", \"y axis\")"
            + textStyle.getStyles()
            + ".call(yAxis);\n";
    xyChartCode +=
        "svg.append(\"text\").attr(\"y\","
            + (0 - getLeftMargin())
            + ").attr(\"dy\", \"1em\").attr(\"transform\",\"rotate(-90)\")"
            + textStyle.getStyles()
            + ".attr(\"x\","
            + (0 - getHeight() / 2)
            + ").attr(\"text-anchor\", \"middle\").text(\""
            + yAxis.getTitle()
            + "\");\n";
    xyChartCode += lineStyle.getStyleCode();
    return xyChartCode;
  }
Exemple #2
0
  public String getAxisTitle() {
    axisTitle =
        "svg.append(\"text\").attr(\"x\","
            + (getTotalWidth() / 2)
            + ")"
            + ".attr(\"y\","
            + (getHeight() + getBottomMargin() / 2)
            + ").attr(\"text-anchor\", \"middle\").text(\""
            + xAxis.getTitle()
            + "\");";
    axisTitle +=
        "svg.append(\"text\").attr(\"y\","
            + (getTotalHeight() / 2)
            + ")"
            + ".attr(\"x\","
            + (0 - getLeftMargin() / 2)
            + ").attr(\"transform\", \"rotate(-90)\").attr(\"text-anchor\", \"middle\").text(\""
            + xAxis.getTitle()
            + "\");";

    return axisTitle;
  }