【问题标题】:Processing 2+ Create multiple italic text legends处理 2+ 创建多个斜体文本图例
【发布时间】:2015-03-23 16:41:42
【问题描述】:

我想为条形图创建一个图例,如下所示:

 |  |  |  |
/  /  /  /

在哪里 | :数据列, / : 是每一列的图例

我无法正确获取文本图例,尝试多个 maxtrix 转换,但没有一个能正常工作。

for (int col = 0; col < 4; col++) {
                       // Draw emotions legends
                applet.fill(100);
                applet.textFont(font, 20);

                // perform matrix transform
                applet.rotate(-0.75f);
                applet.translate(col * columnW, h);

                // draw text
                applet.text(legends[col], 0, 0);

                // undo matrix
                applet.translate(-col * columnW, -h);
                applet.rotate(0.75f);
}

请帮忙:(

【问题讨论】:

    标签: matrix processing matrix-inverse matrix-transform


    【解决方案1】:

    对于那些想知道答案的人:

    for (int col = 0; col < 4; col++) {
                    applet.pushMatrix();
                    applet.translate(col * blockW, h);
                    // Rotate the text
                    applet.rotate(-0.75f);
    
                    // Display the text
                    applet.text(Emotion.values()[col].toString(), 0, 0);
                    applet.popMatrix();
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-12-18
      • 2014-06-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-11
      相关资源
      最近更新 更多