model.setValue("Purple Events", new Double(size > 0 ? (purple/size)*100 : 0));
mychart.setModel(model);
}
public void onEventCreate$calendars(ForwardEvent event) {
CalendarsEvent evt = (CalendarsEvent) event.getOrigin();
int left = evt.getX();
int top = evt.getY();
int timeslots = calendars.getTimeslots();
int timeslotTime = 60 / timeslots;
if (top + 245 > evt.getDesktopHeight())
top = evt.getDesktopHeight() - 245;
if (left + 410 > evt.getDesktopWidth())
left = evt.getDesktopWidth() - 410;
createEvent.setLeft(left + "px");
createEvent.setTop(top + "px");
SimpleDateFormat create_sdf = new SimpleDateFormat("HH:mm");
create_sdf.setTimeZone(calendars.getDefaultTimeZone());
String[] times = create_sdf.format(evt.getBeginDate()).split(":");
int hours = Integer.parseInt(times[0]) * timeslots;
int mins = Integer.parseInt(times[1]);
int bdTimeSum = hours + mins;
hours += mins / timeslotTime;
createEvent$ppbt.setSelectedIndex(hours * 12 / timeslots);
times = create_sdf.format(evt.getEndDate()).split(":");
hours = Integer.parseInt(times[0]) * timeslots;
mins = Integer.parseInt(times[1]);
int edTimeSum = hours + mins;
hours += mins / timeslotTime;
((Listbox)createEvent.getFellow("ppet")).setSelectedIndex(hours * 12 / timeslots);
boolean isAllday = (bdTimeSum + edTimeSum) == 0;
createEvent$ppbegin.setTimeZone(calendars.getDefaultTimeZone());
createEvent$ppbegin.setValue(evt.getBeginDate());
createEvent$ppend.setTimeZone(calendars.getDefaultTimeZone());
createEvent$ppend.setValue(evt.getEndDate());
createEvent$ppallDay.setChecked(isAllday);
createEvent$pplocked.setChecked(false);
createEvent$ppbt.setVisible(!isAllday);
createEvent$ppet.setVisible(!isAllday);
createEvent.setVisible(true);
createEvent.setAttribute("calevent", evt);
evt.stopClearGhost();
}