org.wicketstuff.flot.FlotPanel Maven / Gradle / Ivy
/*
* Copyright 2009 Michael Würtinger ([email protected])
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wicketstuff.flot;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.wicket.markup.ComponentTag;
import org.apache.wicket.markup.MarkupStream;
import org.apache.wicket.markup.html.WebComponent;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.markup.parser.XmlTag;
import org.apache.wicket.model.IModel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class FlotPanel extends Panel
{
/** Required by {@link Serializable} */
private static final long serialVersionUID = 1L;
private static final Logger LOGGER = LoggerFactory.getLogger(FlotPanel.class);
private final Map> options = new HashMap>();
private boolean showTooltip = false;
public FlotPanel(final String id, final IModel> model)
{
super(id, model);
String[] optionsKeys = { "lines", "points", "legend", "xaxis", "yaxis", "x2axis", "y2axis",
"selection", "grid" };
for (String key : optionsKeys)
options.put(key, new HashMap());
options.get("selection").put("mode", "xy");
options.get("grid").put("hoverable", true);
options.get("grid").put("clickable", true);
// JN - commented out to allow autoscaling if not set
// options.get("yaxis").put("min", 0);
// options.get("yaxis").put("max", 15);
// This custom component fills the