chart-elements | Chart.js as Polymer Elements | Web Framework library
kandi X-RAY | chart-elements Summary
kandi X-RAY | chart-elements Summary
Chart.js as Polymer Elements
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of chart-elements
chart-elements Key Features
chart-elements Examples and Code Snippets
Community Discussions
Trending Discussions on chart-elements
QUESTION
I am trying to plot a zing chart in angular2. My chart comes out to be like this.
While I want my chart to look like the one I provided below, so that the min and max values of the x-axis are auto adjusted to fit to the area and horizontal width of the chart.
How can I go about doing this? I followed these links but could not get the desired results. Could you point where am I going wrong ? https://www.zingchart.com/docs/tutorials/chart-elements/configure-chart-scales/#scale-formatting The options that I gave to plot the chart as follows:
...ANSWER
Answered 2017-Feb-06 at 19:19You do not need to set the attribute auto-fit
true. This is for charts that have zooming applied.
You do not need to set the attributes min-value
or max-value
to get the x-axis to fit automatically. It will do this by default.
The problem might lie in the one part of the chart you didn't give any information about. How is your data plotted? What are the value arrays? Array of Arrays?
Post the full chart JSON and I'll get you a demo working. Since your chart is dynamic you can grab the rendering JSON by right clicking on the chart, clicking the View Source option, then copying the contents from the parsed JSON tab.
EDITED NEW ANSWER IN RESPONSE TO FIRST COMMENT BELOW:
Array of arrays does not automatically fit the graph width on scaleX. The reason for this is you are requesting to plot something much more specific than a single dimensional array. So you are right to set the minValue
and maxValue
.
The main issue is the step
value. Since you have defined a step that is less precise than values in the minvalue
or maxvalue
you must make it match the same precision. For example you put two decimals, execpt your step is set to step:.2
which is only of precision of one decimal. Change that precision to two. step:.01 || .02
to get the desired results you are looking for.
One quick side note. You have two scale-x
objects. They get merged internally, but this is dangerous because the lower one will override the first. If you have a large JSON this becomes harder to debug.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install chart-elements
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page