2012-04-13 56 views

回答

1

如其在FAQ(第四個問題)中所述:

TimelineJS中最多可​​以使用多少個條目?

時間軸針對多達100個條目進行了優化,最好是20-30條。其他任何可能導致加載問題。

現在也許你不能尊重他們的限制,但我不認爲在「大量的數據」中使用它會是一個很好的體驗。 :)(好吧,你一次只能加載100個條目,但我會留給你)

我不能建議你一個替代方案,對不起。

1

對不起.. 再次,但在英語....

維泰時間表支持JSON作爲數據源,我已經在MVC3項目和路由數據源的控制器。你顯然可以從例如Web服務,或RIA等採取不同的方式....

要啓動的時間表你,把時間軸初始腳本在頭部或身體:

var timeline = new VMM.Timeline(); 
timeline.init("http://localhost:9306/TimeLine/Json"); 

你創建類來存儲數據結構,這將讓你在同一個JSON格式從驅動程序返回類的實例:

public class json 

{
公共時間表時間表 { 得到; 集; } }

public class timeLine 
{ 
public string headline { get; set; } 
public string type { get; set; } 
public string startDate { get; set; } 
public string text { get; set; } 
public asset asset { get; set; } 
public List<date> date { get; set; } 
} 

public class asset 
{ 
public string media { get; set; } 
public string credit { get; set; } 
public string caption { get; set; } 
} 

public class date 
{ 
public string startDate { get; set; } 
public string endDate { get; set; } 
public string headline { get; set; } 
public string text { get; set; } 
public asset asset { get; set; } 
} 

控制器:

public ActionResult Json() 
    { 
    json j = new json(); 

    j.timeline = new timeLine(); 
    j.timeline.headline = "TimeLine"; 
    j.timeline.type = "default"; 
    j.timeline.startDate = DateTime.Now.Year + "," + DateTime.Now.Month; 
    j.timeline.text = "<p>Time Line de todo el contenido.</p>"; 

    j.timeline.asset = new asset(); 
    j.timeline.asset.media = ""; 
    j.timeline.asset.credit = "Desarrollador por Mauricio Farias www.ald.cl    [email protected]"; 
    j.timeline.asset.caption = "Develop By Mauricio Farias"; 

    j.timeline.date = new List<date>(); 
    //for each de tiempos 
    for (int i = 0; i < 20; i++) 
    { 
     date d = new date(); 
     d.startDate = DateTime.Now.Year + "," + DateTime.Now.Month + "," + i; 
     d.endDate = DateTime.Now.Year + "," + DateTime.Now.Month + "," + (i + 1); 
     d.headline = "Headline date for date in timeline"; 
     d.text = "<p>text in date for date in timeline</p>"; 

     d.asset = new asset(); 
     d.asset.media = ""; 
     d.asset.credit = "credit in asset for date in timeline"; 
     d.asset.caption = "caption in asset for date in timeline"; 
     j.timeline.date.Add(d); 
    } 

     return Json(j, JsonRequestBehavior.AllowGet); 
    } 

在聽證會上或在您的情況可能是一個aspx或html頁面(記得把CSS):

<div id="timeline"> 
</div> 
<script src="../../Content/assets/js/timeline-min.js"></script> 
<script src="../../Content/assets/js/script.js"></script> 
+0

嘿毛裏西奧! Thnx的答案。你很高興給我一個簡短的介紹。如果時間線工具能夠很好地處理大量數據,那麼我真正關心的是問題。所以如果你使用這個工具和大量的數據,它會在瀏覽器中正常滾動嗎?或者它會減慢系統? thnx! – headkit 2012-04-25 09:58:45

相關問題