小编ran*_*425的帖子

Google图表上的最大值和最小值

如何在Google Chart上设置最大值和最小值?

我试过这个没有成功:

vAxis: {
    viewWindowMode:'explicit',
        viewWindow: {
            max:3000,
            min:500
        }
    }
Run Code Online (Sandbox Code Playgroud)

这是我正在使用的所有代码:

<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
      google.load("visualization", "1.1", {packages:["bar"]});
      google.setOnLoadCallback(drawChart);
      function drawChart() {
        var data = google.visualization.arrayToDataTable([
          ['Year', 'Sales', 'Expenses', 'Profit'],
          ['2014', 1000, 400, 200],
          ['2015', 1170, 460, 250],
          ['2016', 660, 1120, 300],
          ['2017', 1030, 540, 350]
        ]);

        var options = {
          chart: {
            title: 'Company Performance',
            subtitle: 'Sales, Expenses, and Profit: 2014-2017',
          },
          vAxis: {
            viewWindowMode:'explicit',
            viewWindow: {
              max:3000,
              min:500
            }
        },
          bars: 'vertical' // Required for …
Run Code Online (Sandbox Code Playgroud)

google-visualization

17
推荐指数
1
解决办法
4万
查看次数

Laravel多态关系commentable_type验证

我正在使用REST API来接收数据。
数据模型与多态相关,类似于文档中的数据:https :
//laravel.com/docs/5.4/eloquent-relationships#polymorphic-relations

posts
    id - integer
    title - string
    body - text

videos
    id - integer
    title - string
    url - string

comments
    id - integer
    body - text
    commentable_id - integer
    commentable_type - string
Run Code Online (Sandbox Code Playgroud)

例如,假设API收到了以下新注释:

{
    "body": "This a test comment",
    "commentable_type": "posts",
    "commentable_id": "1"
}
Run Code Online (Sandbox Code Playgroud)

如何验证收到的commentable_type是否存在并且有效?

php laravel eloquent

5
推荐指数
3
解决办法
2128
查看次数

单击触发元素内部时如何防止Bootstrap Modal打开?

我已经设置了我的表的所有行来打开一个bootstrap模式.
但是,在每一行中,我都有一个选择框,其中包含一些用户必须能够选择的状态.
单击选择框时,如何防止打开模式?

这是我的代码:

HTML

<div class="row">
    <div class="col-md-6">
        <table class="table">
            <tr>
                <th>Name</th>
                <th>Status</th>
            </tr>
            <tr class="user-row" data-toggle="modal" data-target="#myModal">
                <td>John Doe</td>
                <td>
                    <select class="form-control status-selection">
                        <option></option>
                        <option>Active</option>
                        <option>Inactive</option>
                    </select>
                </td>
            </tr>
            <tr class="user-row" data-toggle="modal" data-target="#myModal">
                <td>Jane Doe</td>
                <td>
                    <select class="form-control status-selection">
                        <option></option>
                        <option>Active</option>
                        <option>Inactive</option>
                    </select>
                </td>
            </tr>
        </table>
    </div>
</div>

<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">Modal title</h4>
            </div>
            <div class="modal-body"> …
Run Code Online (Sandbox Code Playgroud)

html javascript css jquery twitter-bootstrap

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

如何匹配左右分隔符的字符串?

我有以下字符串:

$string = '{(|Teste 1|)}{(|Teste_2|)}{(|3 3 3 3|)}';
Run Code Online (Sandbox Code Playgroud)

我想提取{(||)}之间的每个子字符串.

我尝试着:

$string = '{(|Teste 1|)}{(|Teste_2|)}{(|3 3 3 3|)}';
preg_match('/([^{\(\|])(.*)([^\|\)}])/', $string, $matches);

echo '<pre>';
print_r($matches);
echo '</pre>';
die();
Run Code Online (Sandbox Code Playgroud)

输出:

Array
(
    [0] => Teste 1|)}{(|Teste_2|)}{(|3 3 3 3
    [1] => T
    [2] => este 1|)}{(|Teste_2|)}{(|3 3 3 
    [3] => 3
)
Run Code Online (Sandbox Code Playgroud)

期望的输出:

Array
(
    [0] => Teste 1
    [1] => Teste_2
    [2] => 3 3 3 
)
Run Code Online (Sandbox Code Playgroud)

我怎样才能完成这个结果?
THKS!

php regex preg-match

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