Menu

StockChart custom time tabs buttons, and tooltip vs scroll bar issues

2012-08-24
2012-11-08
  • Nuno Gonçalves

    Nuno Gonçalves - 2012-08-24

    Hello,
    I'm using StockChart for GWT and I have some questions, and problems:

    First of all, how can I costumize the time buttons? I get always 1m, 3m, 6m, YTD, 1y, ALL. I'd like to set this my way, and i18ed. I saw an example with minutes and seconds, so I guess that's possible.

    Second is more of an issue.

    If I don't set my tooltip, the navigation, and scroll bar works fine, but if I try to set the tooltip, like this:

    Tooltip toolTip = new ToolTip();
    toolTip.setFormatter(new ToolTipFormatter() {
    @Override
    public String format(final ToolTipData toolTipData) {
    //method to return the html string
    return createToolTipString(toolTipData.getSeriesName(),
    toolTipData.getXAsLong(), toolTipData.getYAsLong());
    }
    };
    );
    chart.setToolTip(toolTip);

    It doesn't get displayed, not event the default one, and whenever I use the scroll, press the right or left buttons, or try to pan the data, the cursor turns to "cursor: e-resize" and wherever I move the mouse, the time frame is affected by it.

    Is it an issue? Please, some help would be appreciated.

     
  • Vince

    Vince - 2012-11-08

    for your time buttons here's an example

        chart.setRangeSelector(new RangeSelector()
                .setOption("buttons", new ChartButton[]{
                        new ChartButton()
                                .setType("year")
                                .setCount(1)
                                .setText("1y"),
                        new ChartButton()
                                .setType("month")
                                .setCount(6)
                                .setText("6m"),
                        new ChartButton()
                                .setType("month")
                                .setCount(3)
                                .setText("3m"),
                        new ChartButton()
                                .setType("month")
                                .setCount(1)
                                .setText("1m"),
                        new ChartButton()
                                .setType("day")
                                .setCount(1)
                                .setText("1d")})
    

    and then

    public class ChartButton extends Configurable<chartbutton> {</chartbutton>

    public ChartButton setType(String type) {
        return this.setOption("type", type);
    }
    
    public ChartButton setCount(Number count) {
        return this.setOption("count", count);
    }
    
    public ChartButton setText(String text) {
        return this.setOption("text", text);
    }
    

    }

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.