Stat.getRBarplotString C# (CSharp) Method

getRBarplotString() private method

private getRBarplotString ( GraphROptions gro, string fileName, Sides side ) : string
gro GraphROptions
fileName string
side Sides
return string
    private string getRBarplotString(GraphROptions gro, string fileName, Sides side)
    {
        string allData = convertDataToR(gro, side);

        string ylabStr = "";
        if(side == Sides.RIGHT) {
            if(CurrentGraphData.LabelRight != "")
                ylabStr = ", ylab='" + Util.RemoveTilde(CurrentGraphData.LabelRight) + "'";
        }
        else { //ALL or LEFT
            if(CurrentGraphData.LabelLeft != "")
                ylabStr = ", ylab='" + Util.RemoveTilde(CurrentGraphData.LabelLeft) + "'";
        }

        //black only has no sense on barplot
        if(gro.Palette == Constants.GraphPaletteBlack)
            gro.Palette="gray.colors";

        string rG = //rGraphString
           	" colors=" + gro.Palette +"(length(rownames(data)))\n" +
            "barplot(data, beside=T, col=colors, lwd="+ gro.LineWidth +", las=2, xlab=''" + ylabStr + ")\n" +
            " legend('" + gro.Legend +"', legend=rownames(data), cex=.7, col=colors, pch=15)\n";

        //have an unique title for both graphs
        string titStr = getTitle("Barplot","");
        if(hasTwoAxis()) {
               if(side==Sides.RIGHT)
                rG += "par(mfrow=c(1,1), new=TRUE)\n" +
                    "plot(-1, axes=FALSE, type='n', xlab='', ylab='')\n" +
                    titStr +
                    "par(mfrow=c(1,1), new=FALSE)\n";
        } else
            rG += titStr;

        return allData + rG;
    }