大家好!
我使用chartjs-plugin-datalabels通过在他的条形上方显示值来防止不可悬停的微小值,但是当其中之一具有最高值时,数据标签超过图表容器的限制
更新:
此外,您可以使用suggestedMax选项,我认为这比提供填充更好
const options = {
plugins: {
datalabels: {
color: '#374774',
font: { family: 'MyriadSemiBold', size: 14 },
align: 'end',
anchor: 'end',
formatter: (value) => {
if (value > 0) {
return localizeNumber(value)
}
return ''
},
},
legend: { display: false },
},
scales: {
x: {
grid: { lineWidth: 0 },
ticks: {
display: false,
},
},
y: {
// Highest value in your datasets
suggestedMax: highestValue > 0 ? highestValue …Run Code Online (Sandbox Code Playgroud) 我有输入字符串"lorrem ipsssum dollorrrrum"和我要计数相同的字母,如果在当前的字母是一样的前面的字母和更改所有的下一个相同的字母就以计数的那封信,
我希望确切的结果如下所示:
"lor2emips3umdol2or4um"
Run Code Online (Sandbox Code Playgroud)
我被卡住了,我不知道我应该使用什么算法,以及在谷歌中搜索这个问题的关键字:(
到目前为止我写的代码
"lor2emips3umdol2or4um"
Run Code Online (Sandbox Code Playgroud)
我认为我运行的代码是正确的,但在运行的某个时刻甚至出现错误'Call to undefined function delete_cookie()'
请指正:)
在控制器 Product_Ref.php 中
public function index()
{
$ref = $this->input->get('id');
$getIdOrder = $this->product_model->getIdOrder($ref);
if ($getIdOrder) {
$this->load->helper('cookie');
$cookie = array(
'name' => 'refProductcookie',
'value' => $ref,
'expire' => '43200'
);
$this->input->set_cookie($cookie);
echo get_cookie('refProductcookie').'<br>';
}else {
echo "Sorry this product has not been registered yet";
delete_cookie('refProductcookie');
}
}
Run Code Online (Sandbox Code Playgroud)