我希望在这里找到解决方案。我使用的是来自https://github.com/ConsoleTVs/Charts的laravel 5.6和laravel图表
我的问题是:
我用来自控制器的数据库中的数据创建了一个图表,并在视图中显示它,它工作得很好。现在我想将这个图表显示到另一个视图中,所以我决定在创建composer服务提供者之后将包含该图表的变量放入view composer中。
当我放入简单的数据时,它会完美地呈现,但当我放入图表变量时,它不会呈现为图形图表,而是呈现为带有标记的代码。下面是呈现的代码:
<canvas style="display: none;" id="tfypgmkjwulqasnhcxbdozive" height='400' ></canvas>
<div id="tfypgmkjwulqasnhcxbdozive_loader" style=" display: flex; justify-content: center; opacity: 1; align-items: center; height: 400px; ">
<svg width="50" height="50" viewBox="0 0 38 38" xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient x1="8.042%" y1="0%" x2="65.682%" y2="23.865%" id="a">
<stop stop-color="#22292F" stop-opacity="0" offset="0%"/>
<stop stop-color="#22292F" stop-opacity=".631" offset="63.146%"/>
<stop stop-color="#22292F" offset="100%"/>
</linearGradient>
</defs>
<g fill="none" fill-rule="evenodd">
<g transform="translate(1 1)">
<path d="M36 18c0-9.94-8.06-18-18-18" id="Oval-2" stroke="url(#a)" stroke-width="2">
<animateTransform attributeName="transform" type="rotate" from="0 18 18" to="360 18 18" dur="0.9s" repeatCount="indefinite" />
</path>
<circle fill="#22292F" cx="36" cy="18" r="1">
<animateTransform attributeName="transform" type="rotate" from="0 18 18" to="360 18 18" dur="0.9s" repeatCount="indefinite" />
</circle>
</g>
</g>
</svg>
</div>这几天我一直在努力,但是没有提前感谢你的帮助。
发布于 2018-10-22 04:18:05
您确定view composer可以工作吗?在视图文件中使用dd()检查它
https://stackoverflow.com/questions/52914230
复制相似问题