<p>As a way to learn Go (besides going through a bunch of tutorials), I wrote GopherJS bindings for a pretty cool JS charts library (<a href="https://github.com/frappe/charts" rel="nofollow">https://github.com/frappe/charts</a>) that I wanted to share.</p>
<p>lib here: <a href="https://github.com/cnguy/gopherjs-frappe-charts" rel="nofollow">https://github.com/cnguy/gopherjs-frappe-charts</a></p>
<p>I'm still trying to learn the basics of Go. Clearly there is a lot of duplicate code, basically no tests (although it is purely a UI library), and I have on idea how to manage Go versions or whatever (I'm a JavaScript guy). I'm also having trouble with interface{} and GopherJS. I would definitely prefer it if the users can pass in float64[] array instead of interface{}, and then the library converts it under the hood. Is this a good idea? I also have another problem where the x-axis labels can be strings or numbers (like year numbers). I couldn't figure out how to allow both though besides doing interface{}.</p>
<p>Any feedback/suggestions would be appreciated.</p>
<hr/>**评论:**<br/><br/>jlaracil: <pre><p>I'm writing a GopherJS bindings for most popular Cordova plugins, adapting the asynchronous javascript api calls to Golang synchronous style.</p>
<p>Some documentation is missing, but it can serve as a reference to make idiomatic GopherJS bindings.</p>
<p><a href="https://github.com/jaracil/goco" rel="nofollow">https://github.com/jaracil/goco</a></p>
<p><a href="https://godoc.org/github.com/jaracil/goco" rel="nofollow">https://godoc.org/github.com/jaracil/goco</a></p></pre>csthrowaway25: <pre><p>thanks. im definitely missing some important things like error handling too - i'm just not sure what other errors i can check for yet (one i can think of is if the length of any of the values in datasets is not equal to the length of the labels. another is if the user doesn't pass in a reference to the html tag to initialize the chart in)</p></pre>TrueFurby: <pre><p>For the x-axis labels why not just use strings? Just convert numbers to strings.</p></pre>csthrowaway25: <pre><p>Mhmm, I decided to use string labels now while providing a helper to convert int arrays to str arrays for convenience.*</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传