LightSwitch HTML Edition
Setting up D3 Timeline Screen

In this topic, you first need to Create a LightSwitch for HTML Project and then Connect to an External OData Service.

In order to instantiate a screen template for the D3 Timeline, you need to add a new Browse screen to your project by implementing the following steps.

  1. In Solution Explorer, expand your HTMLClient project, right-click on the Screens folder and select Add Screen. The Add New Screen dialog box appears.
  2. In the Add New Screen dialog box select Browse Data Screen and enter D3TimeLine for the Screen Name and select DemoServiceData.NormalTemperatures from the Screen Data dropdown listbox, then choose OK. The D3Timeline.lsml is added to the Screens folder.
  3. In the D3Timeline.lsml click on the dropdown arrow next to the List control and choose D3 Collection Control.
  4. Reorder the properties according to the properties expected by the control. The properties should appear in the following order.
  5. On the D3Treemap.lsml page click on the link, Edit Query.
  6. Expand the Sort node and click Add Sort, then set the Sort by to c_Date in Ascending order.
  7. Click the link Back to D3Timeline.
  8. On the D3Treemap.lsml page select the D3 Collection Control and expand the General node in the Properties window, then scroll down to the Widget property and set it to Timeline.
  9. Click Edit Render Code in the Properties window to automatically create the following Javascript code.
    JavaScript
    Copy Code
    myapp.Timeline.NormalTemperature_render = function (element, contentItem) {
    
        var div = $("<div/>");
        div.appendTo($(element));
    
        var options = {
            width: 600,
            height: 400
        };
    
        var timeline = d3ls.timeline(element, contentItem, options);
    };
    
  10. In the Solution Explorer, right-click on the Timeline.lsml file and select Set as Home Screen.
  11. Run the project and see how the Timeline control appears. Notice how moving the slider rectangle at the bottom of the Timeline chart changes the range displayed at the top of the chart.

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Documentation Feedback  |  Product Support Forum