vis = require("vis-timeline/standalone/umd/vis-timeline-graph2d.min.js")
dsouzaTimeline = {
// 1. Create a reactive container
const div = html`<div style="width: 100%; height: 500px; border: 1px solid lightgray;"></div>`;
// Add custom styles for the timeline items
const style = html`<style>
.vis-item.red { background-color: #ffcccc; border-color: #ff0000; color: #333; }
.vis-item.green { background-color: #ccffcc; border-color: #00ff00; color: #333; }
.vis-item.blue { background-color: #cce5ff; border-color: #0066cc; color: #333; }
.vis-item { border-width: 2px; }
</style>`;
div.appendChild(style);
// 2. Create Data
var items = new vis.DataSet([
{id: 1, content: 'Illiberal Education', start: '1991-01-01', title: 'Published Illiberal Education: The Politics of Race and Sex on Campus', group: 1},
{id: 2, content: 'The End of Racism', start: '1995-01-01', title: 'Published The End of Racism', group: 1},
{id: 3, content: 'Roots of Obama\'s Rage', start: '2010-09-01', title: 'Published The Roots of Obama\'s Rage', group: 1},
{id: 4, content: '2016: Obama\'s America', start: '2012-07-13', title: 'Released 2016: Obama\'s America', group: 2, className: 'blue'},
{id: 5, content: 'Resigns King\'s College', start: '2012-10-18', title: 'Resigned from The King\'s College amid scandal', group: 3, className: 'red'},
{id: 6, content: 'Felony Conviction', start: '2014-05-20', title: 'Pleaded guilty to campaign finance fraud', group: 3, className: 'red'},
{id: 7, content: 'America (Film)', start: '2014-06-27', title: 'Released America: Imagine the World Without Her', group: 2, className: 'blue'},
{id: 8, content: 'Hillary\'s America', start: '2016-07-15', title: 'Released Hillary\'s America', group: 2, className: 'blue'},
{id: 9, content: 'Trump Pardon', start: '2018-05-31', title: 'Pardoned by President Trump', group: 3, className: 'green'},
{id: 10, content: 'Death of a Nation', start: '2018-08-03', title: 'Released Death of a Nation', group: 2, className: 'blue'},
{id: 11, content: '2000 Mules', start: '2022-05-20', title: 'Released 2000 Mules', group: 2, className: 'blue'},
{id: 12, content: '2000 Mules Retracted', start: '2024-05-31', title: 'Salem Media retracts 2000 Mules and apologizes', group: 3, className: 'red'},
{id: 13, content: 'Vindicating Trump', start: '2024-09-27', title: 'Released Vindicating Trump', group: 2, className: 'blue'}
]);
var groups = new vis.DataSet([
{id: 1, content: 'Books'},
{id: 2, content: 'Films'},
{id: 3, content: 'Legal/Controversy'}
]);
// 3. Configuration for the Timeline
var options = {
height: '500px',
start: '2010-01-01',
end: '2026-01-01',
zoomMin: 1000 * 60 * 60 * 24 * 30, // 1 month
zoomMax: 1000 * 60 * 60 * 24 * 365 * 40, // 40 years
orientation: 'top'
};
// 4. Create a Timeline
var timeline = new vis.Timeline(div, items, groups, options);
return div;
}