/*
* The MIT License (MIT)
*
* Copyright (c) 2014-2015 abel533@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.github.abel533.echarts.samples.line;
import com.github.abel533.echarts.axis.AxisLabel;
import com.github.abel533.echarts.axis.CategoryAxis;
import com.github.abel533.echarts.axis.ValueAxis;
import com.github.abel533.echarts.code.Magic;
import com.github.abel533.echarts.code.Tool;
import com.github.abel533.echarts.code.Trigger;
import com.github.abel533.echarts.code.X;
import com.github.abel533.echarts.feature.MagicType;
import com.github.abel533.echarts.series.Line;
import com.github.abel533.echarts.util.EnhancedOption;
import org.junit.Test;
import java.util.Arrays;
import java.util.List;
/**
* @author liuzh
*/
public class LineTest6 {
@Test
public void test() {
//地址:http://echarts.baidu.com/doc/example/line6.html
EnhancedOption option = new EnhancedOption();
option.title().text("雨量流量关系图").subtext("数据来自西安兰特水电测控技术有限公司").x(X.center);
option.tooltip().trigger(Trigger.axis).formatter("function(v){" +
"return v[0][1] + '<br>'" +
" + v[0][0] + ' : ' + v[0][2] + ' (m^3/s)<br/>'" +
"+ v[1][0] + ' : ' + -v[1][2] + ' (mm)';" +
"}");
option.legend("流量", "降雨量").legend().x(X.left);
option.toolbox().show(true).feature(
Tool.mark,
Tool.dataView,
new MagicType(Magic.line, Magic.bar),
Tool.restore,
Tool.saveAsImage);
option.dataZoomNew().show(true).realtime(true).start(0).end(100);
option.yAxis(new ValueAxis().name("流量(m^3/s)").max(500));
option.yAxis(new ValueAxis().name("降雨量(mm)").axisLabel(new AxisLabel().formatter("function(v){return -v;}")));
CategoryAxis categoryAxis = new CategoryAxis();
categoryAxis.boundaryGap(false).axisLine().onZero(false);
categoryAxis.data("2009/6/12 2:00", "2009/6/12 3:00", "2009/6/12 4:00", "2009/6/12 5:00", "2009/6/12 6:00", "2009/6/12 7:00", "2009/6/12 8:00", "2009/6/12 9:00", "2009/6/12 10:00", "2009/6/12 11:00", "2009/6/12 12:00", "2009/6/12 13:00", "2009/6/12 14:00", "2009/6/12 15:00", "2009/6/12 16:00", "2009/6/12 17:00", "2009/6/12 18:00", "2009/6/12 19:00", "2009/6/12 20:00", "2009/6/12 21:00", "2009/6/12 22:00", "2009/6/12 23:00",
"2009/6/13 0:00", "2009/6/13 1:00", "2009/6/13 2:00", "2009/6/13 3:00", "2009/6/13 4:00", "2009/6/13 5:00", "2009/6/13 6:00", "2009/6/13 7:00", "2009/6/13 8:00", "2009/6/13 9:00", "2009/6/13 10:00", "2009/6/13 11:00", "2009/6/13 12:00", "2009/6/13 13:00", "2009/6/13 14:00", "2009/6/13 15:00", "2009/6/13 16:00", "2009/6/13 17:00", "2009/6/13 18:00", "2009/6/13 19:00", "2009/6/13 20:00", "2009/6/13 21:00", "2009/6/13 22:00", "2009/6/13 23:00",
"2009/6/14 0:00", "2009/6/14 1:00", "2009/6/14 2:00", "2009/6/14 3:00", "2009/6/14 4:00", "2009/6/14 5:00", "2009/6/14 6:00", "2009/6/14 7:00", "2009/6/14 8:00", "2009/6/14 9:00", "2009/6/14 10:00", "2009/6/14 11:00", "2009/6/14 12:00", "2009/6/14 13:00", "2009/6/14 14:00", "2009/6/14 15:00", "2009/6/14 16:00", "2009/6/14 17:00", "2009/6/14 18:00", "2009/6/14 19:00", "2009/6/14 20:00", "2009/6/14 21:00", "2009/6/14 22:00", "2009/6/14 23:00",
"2009/6/15 0:00", "2009/6/15 1:00", "2009/6/15 2:00", "2009/6/15 3:00", "2009/6/15 4:00", "2009/6/15 5:00", "2009/6/15 6:00", "2009/6/15 7:00", "2009/6/15 8:00", "2009/6/15 9:00", "2009/6/15 10:00", "2009/6/15 11:00", "2009/6/15 12:00", "2009/6/15 13:00", "2009/6/15 14:00", "2009/6/15 15:00", "2009/6/15 16:00", "2009/6/15 17:00", "2009/6/15 18:00", "2009/6/15 19:00", "2009/6/15 20:00", "2009/6/15 21:00", "2009/6/15 22:00", "2009/6/15 23:00",
"2009/6/15 0:00", "2009/6/16 1:00", "2009/6/16 2:00", "2009/6/16 3:00", "2009/6/16 4:00", "2009/6/16 5:00", "2009/6/16 6:00", "2009/6/16 7:00", "2009/6/16 8:00", "2009/6/16 9:00", "2009/6/16 10:00", "2009/6/16 11:00", "2009/6/16 12:00", "2009/6/16 13:00", "2009/6/16 14:00", "2009/6/16 15:00", "2009/6/16 16:00", "2009/6/16 17:00", "2009/6/16 18:00", "2009/6/16 19:00", "2009/6/16 20:00", "2009/6/16 21:00", "2009/6/16 22:00", "2009/6/16 23:00",
"2009/6/15 0:00", "2009/6/17 1:00", "2009/6/17 2:00", "2009/6/17 3:00", "2009/6/17 4:00", "2009/6/17 5:00", "2009/6/17 6:00", "2009/6/17 7:00", "2009/6/17 8:00", "2009/6/17 9:00", "2009/6/17 10:00", "2009/6/17 11:00", "2009/6/17 12:00", "2009/6/17 13:00", "2009/6/17 14:00", "2009/6/17 15:00", "2009/6/17 16:00", "2009/6/17 17:00", "2009/6/17 18:00", "2009/6/17 19:00", "2009/6/17 20:00", "2009/6/17 21:00", "2009/6/17 22:00", "2009/6/17 23:00",
"2009/6/18 0:00", "2009/6/18 1:00", "2009/6/18 2:00", "2009/6/18 3:00", "2009/6/18 4:00", "2009/6/18 5:00", "2009/6/18 6:00", "2009/6/18 7:00", "2009/6/18 8:00", "2009/6/18 9:00", "2009/6/18 10:00", "2009/6/18 11:00", "2009/6/18 12:00", "2009/6/18 13:00", "2009/6/18 14:00", "2009/6/18 15:00", "2009/6/18 16:00", "2009/6/18 17:00", "2009/6/18 18:00", "2009/6/18 19:00", "2009/6/18 20:00", "2009/6/18 21:00", "2009/6/18 22:00", "2009/6/18 23:00",
"2009/6/15 0:00", "2009/6/19 1:00", "2009/6/19 2:00", "2009/6/19 3:00", "2009/6/19 4:00", "2009/6/19 5:00", "2009/6/19 6:00", "2009/6/19 7:00", "2009/6/19 8:00", "2009/6/19 9:00", "2009/6/19 10:00", "2009/6/19 11:00", "2009/6/19 12:00", "2009/6/19 13:00", "2009/6/19 14:00", "2009/6/19 15:00", "2009/6/19 16:00", "2009/6/19 17:00", "2009/6/19 18:00", "2009/6/19 19:00", "2009/6/19 20:00", "2009/6/19 21:00", "2009/6/19 22:00", "2009/6/19 23:00",
"2009/6/20 0:00", "2009/6/20 1:00", "2009/6/20 2:00", "2009/6/20 3:00", "2009/6/20 4:00", "2009/6/20 5:00", "2009/6/20 6:00", "2009/6/20 7:00", "2009/6/20 8:00", "2009/6/20 9:00", "2009/6/20 10:00", "2009/6/20 11:00", "2009/6/20 12:00", "2009/6/20 13:00", "2009/6/20 14:00", "2009/6/20 15:00", "2009/6/20 16:00", "2009/6/20 17:00", "2009/6/20 18:00", "2009/6/20 19:00", "2009/6/20 20:00", "2009/6/20 21:00", "2009/6/20 22:00", "2009/6/20 23:00",
"2009/6/21 0:00", "2009/6/21 1:00", "2009/6/21 2:00", "2009/6/21 3:00", "2009/6/21 4:00", "2009/6/21 5:00", "2009/6/21 6:00", "2009/6/21 7:00", "2009/6/21 8:00", "2009/6/21 9:00", "2009/6/21 10:00", "2009/6/21 11:00", "2009/6/21 12:00", "2009/6/21 13:00", "2009/6/21 14:00", "2009/6/21 15:00", "2009/6/21 16:00", "2009/6/21 17:00", "2009/6/21 18:00", "2009/6/21 19:00", "2009/6/21 20:00", "2009/6/21 21:00", "2009/6/21 22:00", "2009/6/21 23:00",
"2009/6/22 0:00", "2009/6/22 1:00", "2009/6/22 2:00", "2009/6/22 3:00", "2009/6/22 4:00", "2009/6/22 5:00", "2009/6/22 6:00", "2009/6/22 7:00", "2009/6/22 8:00", "2009/6/22 9:00", "2009/6/22 10:00", "2009/6/22 11:00", "2009/6/22 12:00", "2009/6/22 13:00", "2009/6/22 14:00", "2009/6/22 15:00", "2009/6/22 16:00", "2009/6/22 17:00", "2009