我一直试图改变背景线的颜色,以及轴的字体大小和颜色,但无济于事.我目前正在使用最新版本的charts.js,似乎无法弄清楚如何进行更改.在旧版本的图表中,我可以更改它们,但该代码不再有效.
这是我的代码:
var lineoptions = {
legend:{
display:false
},
scales:{
yAxes:[{
display:false
}]
},
tooltips:{
enabled:false
},
elements:{
point:{
radius:4,
borderWidth:2
}
}
};
var linedata = {
labels:[
"618",
"39",
"1734",
"3459"
],
datasets:[
{
data:[618,39,1734,3459],
fill:false,
borderColor:"rgba(227,6,20,1)",
pointBorderColor:"rgba(227,6,20,1)",
pointBackgroundColor:"rgba(255,255,255,1)",
pointHoverBackgroundColor:"rgba(255,255,255,1)",
pointHoverBorderColor:"rgba(227,6,20,1)",
}]
};
var linechart = document.getElementById("canvas-line").getContext("2d");
var myLineChart = new Chart(linechart,{
type:'line',
data:linedata,
options:lineoptions
});
Run Code Online (Sandbox Code Playgroud)
*编辑*
我设法通过使用以下方法更改轴信息的颜色:
defaultFontColor:'#6d6e71',
Run Code Online (Sandbox Code Playgroud)
但我仍然需要弄清楚如何更改图表本身的背景线(x和y线).
我正在尝试做某种函数,它会找到(在下面的数组中)id为2的对象,并将其移动到数组的顶部.这是原始数组:
Array
(
[0] => stdClass Object
(
[id] => 177
[startdate] => 2014-08-02
)
[1] => stdClass Object
(
[id] => 178
[startdate] => 2014-08-02
)
[2] => stdClass Object
(
[id] => 2
[startdate] => 2014-07-28
)
[3] => stdClass Object
(
[id] => 82
[startdate] => 2014-07-28
)
[4] => stdClass Object
(
[id] => 199
[startdate] => 2013-10-10
)
)
Run Code Online (Sandbox Code Playgroud)
这是我想要输出的内容(使用移动的数组项):
Array
(
[0] => stdClass Object
(
[id] => 2
[startdate] => 2014-07-28
)
[1] …Run Code Online (Sandbox Code Playgroud) 这可能是愚蠢的简单,但我想找到一种方法将类添加到无序列表,然后在每第三个项后交替该类.
我只是为每三个项目添加一个类(这不是我想要的),但这是我的代码:
<?php $i=1; foreach($this->items as $item) : ?>
<li class="<?php if ($i % 3 == 0) : ?>odd<?php endif; ?>"><a href="<?php echo $linky; ?>">xxx</a></li>
<?php $i++; endforeach; ?>
Run Code Online (Sandbox Code Playgroud)
吐出来的:
<li class="">xxx</li>
<li class="">xxx</li>
<li class="odd">xxx</li>
<li class="">xxx</li>
<li class="">xxx</li>
<li class="odd">xxx</li>
Run Code Online (Sandbox Code Playgroud)
但我希望得到的是:
<li class="odd">xxx</li>
<li class="odd">xxx</li>
<li class="odd">xxx</li>
<li class="even">xxx</li>
<li class="even">xxx</li>
<li class="even">xxx</li>
Run Code Online (Sandbox Code Playgroud)
等等.通常我会用jquery做这样的事情,但在这种情况下我必须使用php ..任何帮助都会非常感激:)
本迪戈银行告诉我,我们需要将md5更改为SHA256.我按照他们的指示,我收到了这个错误:
HTTP Status - 400
E5000: Cannot form a matching secure hash based on the merchant's request using either of the two merchant's secrets
Run Code Online (Sandbox Code Playgroud)
他们的示例代码如下:
<?php foreach($_POST as $key => $value) {
if (strlen($value) > 0) { ?>
<input type="hidden" name="<?php echo($key); ?>" value="<?php echo($value); ?>"/><br>
<?php
if ((strlen($value) > 0) && ((substr($key, 0,4)=="vpc_") || (substr($key,0,5) =="user_"))) {
$hashinput .= $key . "=" . $value . "&";
}
}
}
$hashinput = rtrim($hashinput,"&");
?>
<!-- attach SecureHash --> …Run Code Online (Sandbox Code Playgroud) 我需要将新的OpenCart模板文件添加到另一个模板文件中。
基本上,我已经在/theme/customtheme/template/common/“ header_home.twig”中创建了一个新的头文件。
然后在home.twig中,我将{{header}}更改为{{header_home}},但它没有显示任何内容。
基本上,我要做的就是复制header.twig并将其重命名为header_home.twig,并放入“ xxxxx”以查看它是否在调用新文件,不是。相反,它不显示任何内容。
这是我的home.twig现在的样子:
{{ header_home }}
<div id="common-home" class="container">
<div class="row">{{ column_left }}
{% if column_left and column_right %}
{% set class = 'col-sm-6' %}
{% elseif column_left or column_right %}
{% set class = 'col-sm-9' %}
{% else %}
{% set class = 'col-sm-12' %}
{% endif %}
<div id="content" class="{{ class }}">{{ content_top }}{{ content_bottom }}</div>
{{ column_right }}</div>
</div>
{{ footer …Run Code Online (Sandbox Code Playgroud) 我正在尝试为Google Analytics(分析)设置事件跟踪,并且获得了以下代码:
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXX-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config','UA-XXXXXXXX-1');
</script>
onclick="javascript:gtag('event','Download',{'event_category':'Teacher Guide - Agroforestry','event_label':'Teacher Resource','value':'Teacher Resource'});"
Run Code Online (Sandbox Code Playgroud)
如果单击链接,它将显示在“ 实时”>“事件”下,但不会显示在“ 行为”->“事件”->“概述”下。
有人可以告诉我我是否丢失了某些东西,或者设置不正确吗?
我正在使用以下代码将无序列表分成两列,除了chrome之外,其他方法都可以正常工作。这是我的代码:
.column-list{margin:15px 0 0 0;padding:0;list-style:none;-moz-column-count:2;-webkit-column-count:2;column-count:2}
.column-list li{margin:0 0 15px 0;background:#fff;border-radius:5px;font-size:120%;line-height:normal;font-weight:700;display:block}
.column-list a{padding:25px;display:block}
Run Code Online (Sandbox Code Playgroud)
这就是正在发生的事情(它将li分为两半,并将其放在下一列中):