小编for*_*020的帖子

工具提示中的Google Line Chart日期格式

有没有办法在Google Chart中更改工具提示的日期格式?我不想把它变成HTML,因为它完全符合我的需要.我只想要其他日期格式.正如你所看到的,我改变了hAxis的格式,我想为工具提示做同样的事情.

var data = google.visualization.arrayToDataTable([[{"label":"Month","type":"date"},"Customers"],[new Date('2017-01-01'),30],[new Date('2017-02-01'),45],[new Date('2017-03-01'),55],[new Date('2017-04-01'),40],[new Date('2017-05-01'),20],[new Date('2017-06-01'),17],[new Date('2017-07-01'),15],[new Date('2017-08-01'),18],[new Date('2017-09-01'),0],[new Date('2017-10-01'),0],[new Date('2017-11-01'),0],[new Date('2017-12-01'),0]]);

var options = {"legend":{"position":"bottom"},"pointSize":5,"hAxis":{"format":"MMM","ticks":[new Date('2017-01-01'),new Date('2017-02-01'),new Date('2017-03-01'),new Date('2017-04-01'),new Date('2017-05-01'),new Date('2017-06-01'),new Date('2017-07-01'),new Date('2017-08-01'),new Date('2017-09-01'),new Date('2017-10-01'),new Date('2017-11-01'),new Date('2017-12-01')]},"height":300};

var c = new google.visualization.LineChart(document.getElementById("div-chartw0"));
c.draw(data, options);
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

javascript charts google-visualization

3
推荐指数
1
解决办法
2154
查看次数

角带.Popover程序化使用

我正在尝试以编程方式创建popover,但面临以下问题.我无法在弹出模板中访问父作用域.预期结果是:

Hello my name is Roman
Run Code Online (Sandbox Code Playgroud)

但我明白了

Hello my name is undefined
Run Code Online (Sandbox Code Playgroud)

这里是plunker

如果我bs-popover在任何元素上使用as属性,那么我得到预期的结果.

<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
    <title>Popover issue</title>
</head>

<body>
<div data-ng-app="myApp" data-ng-controller="defaultCtrl" style="margin: 100px 100px">
    <button custom-popover ng-click="showPopover()">Popover</button>

    <script type="text/ng-template" id="example.html">
        <p>My name is {{user.name || 'undefined' }}</p>
    </script>
</div>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.5/angular.min.js"></script>
<script src="//code.angularjs.org/1.3.8/angular-sanitize.min.js" data-semver="1.3.8"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-strap/2.1.5/angular-strap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-strap/2.1.5/angular-strap.tpl.min.js"></script>
<script type="text/javascript">
    var app = angular.module("myApp", ['mgcrea.ngStrap', 'ngSanitize']);
    app.controller("defaultCtrl", ["$scope", function($scope) {
        $scope.user = {
            name: "Roman"
        };
    }]);
    app.directive("customPopover", ["$popover", …
Run Code Online (Sandbox Code Playgroud)

angularjs angularjs-directive angular-strap

2
推荐指数
1
解决办法
6110
查看次数