尝试显示星云甘特星

时间:2019-04-19 13:43:14

标签: java eclipse charts gantt-chart nebula

当我尝试简单地显示带有网站中示例的图表时,出现显示问题:

import java.util.Calendar;
import org.eclipse.nebula.widgets.ganttchart.GanttChart;
import org.eclipse.nebula.widgets.ganttchart.GanttEvent;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;`

public class ConnectionExample {

    public static void main(String [] args) {
        Display display = new Display ();
        Shell shell = new Shell (display);
        shell.setText("Gantt Chart Sample");
        shell.setSize(600, 500);        
        shell.setLayout(new FillLayout());

        // Create a chart
        GanttChart ganttChart = new GanttChart(shell, SWT.NONE);

        // Create some calendars
        Calendar sdEventOne = Calendar.getInstance();
        Calendar edEventOne = Calendar.getInstance();
        edEventOne.add(Calendar.DATE, 10); 

        Calendar sdEventTwo = Calendar.getInstance();
        Calendar edEventTwo = Calendar.getInstance();
        sdEventTwo.add(Calendar.DATE, 11);
        edEventTwo.add(Calendar.DATE, 15);

        Calendar cpDate = Calendar.getInstance();
        cpDate.add(Calendar.DATE, 16);

        // Create events
        GanttEvent eventOne = new GanttEvent(ganttChart, "Scope Event 1",   sdEventOne, edEventOne, 35);        
        GanttEvent eventTwo = new GanttEvent(ganttChart, "Scope Event 2",   sdEventTwo, edEventTwo, 10);        
        GanttEvent eventThree = new GanttEvent(ganttChart, "Checkpoint",    cpDate, cpDate, 75);
        eventThree.setCheckpoint(true);

        // Create connections
        ganttChart.addConnection(eventOne, eventTwo);
        ganttChart.addConnection(eventTwo, eventThree);

        // Show chart
        shell.open();

        while (!shell.isDisposed ()) {
            if (!display.readAndDispatch ()) display.sleep ();
        }
        display.dispose (); 
    }
}

但是我的显示在时间轴上不正确。

您可以看到在时间轴上看不到清晰的[link]。

我尝试了一切,但找不到解决方法。

先谢谢您。

0 个答案:

没有答案