/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you 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.
*/

import * as echarts from '../../echarts';

export default echarts.extendComponentModel({

    type: 'tooltip',

    dependencies: ['axisPointer'],

    defaultOption: {
        zlevel: 0,

        z: 60,

        show: true,

        // tooltip涓讳綋鍐呭
        showContent: true,

        // 'trigger' only works on coordinate system.
        // 'item' | 'axis' | 'none'
        trigger: 'item',

        // 'click' | 'mousemove' | 'none'
        triggerOn: 'mousemove|click',

        alwaysShowContent: false,

        displayMode: 'single', // 'single' | 'multipleByCoordSys'

        renderMode: 'auto', // 'auto' | 'html' | 'richText'
        // 'auto': use html by default, and use non-html if `document` is not defined
        // 'html': use html for tooltip
        // 'richText': use canvas, svg, and etc. for tooltip

        // 浣嶇疆 {Array} | {Function}
        // position: null
        // Consider triggered from axisPointer handle, verticalAlign should be 'middle'
        // align: null,
        // verticalAlign: null,

        // 鏄惁绾︽潫 content 鍦� viewRect 涓€傞粯璁� false 鏄负浜嗗吋瀹逛互鍓嶇増鏈€�
        confine: false,

        // 鍐呭鏍煎紡鍣細{string}锛圱emplate锛� 娄 {Function}
        // formatter: null

        showDelay: 0,

        // 闅愯棌寤惰繜锛屽崟浣峬s
        hideDelay: 100,

        // 鍔ㄧ敾鍙樻崲鏃堕棿锛屽崟浣峴
        transitionDuration: 0.4,

        enterable: false,

        // 鎻愮ず鑳屾櫙棰滆壊锛岄粯璁や负閫忔槑搴︿负0.7鐨勯粦鑹�
        backgroundColor: 'rgba(50,50,50,0.7)',

        // 鎻愮ず杈规棰滆壊
        borderColor: '#333',

        // 鎻愮ず杈规鍦嗚锛屽崟浣峱x锛岄粯璁や负4
        borderRadius: 4,

        // 鎻愮ず杈规绾垮锛屽崟浣峱x锛岄粯璁や负0锛堟棤杈规锛�
        borderWidth: 0,

        // 鎻愮ず鍐呰竟璺濓紝鍗曚綅px锛岄粯璁ゅ悇鏂瑰悜鍐呰竟璺濅负5锛�
        // 鎺ュ彈鏁扮粍鍒嗗埆璁惧畾涓婂彸涓嬪乏杈硅窛锛屽悓css
        padding: 5,

        // Extra css text
        extraCssText: '',

        // 鍧愭爣杞存寚绀哄櫒锛屽潗鏍囪酱瑙﹀彂鏈夋晥
        axisPointer: {
            // 榛樿涓虹洿绾�
            // 鍙€変负锛�'line' | 'shadow' | 'cross'
            type: 'line',

            // type 涓� line 鐨勬椂鍊欐湁鏁堬紝鎸囧畾 tooltip line 鎵€鍦ㄧ殑杞达紝鍙€�
            // 鍙€� 'x' | 'y' | 'angle' | 'radius' | 'auto'
            // 榛樿 'auto'锛屼細閫夋嫨绫诲瀷涓� category 鐨勮酱锛屽浜庡弻鏁板€艰酱锛岀瑳鍗″皵鍧愭爣绯讳細榛樿閫夋嫨 x 杞�
            // 鏋佸潗鏍囩郴浼氶粯璁ら€夋嫨 angle 杞�
            axis: 'auto',

            animation: 'auto',
            animationDurationUpdate: 200,
            animationEasingUpdate: 'exponentialOut',

            crossStyle: {
                color: '#999',
                width: 1,
                type: 'dashed',

                // TODO formatter
                textStyle: {}
            }

            // lineStyle and shadowStyle should not be specified here,
            // otherwise it will always override those styles on option.axisPointer.
        },
        textStyle: {
            color: '#fff',
            fontSize: 14
        }
    }
});