Comments (4)
Hi purplelady,
I have the same problem with the plugin. I stepped into the debugger and found an odd constructor name of 'e', which didn't jive with an expected 'line' or 'bar' name. Perhaps there is a mixup in using .min.js versus .js files. I didn't try to pin it down further.
HOWEVER... I looked at the plugins page again: https://gionkunz.github.io/chartist-js/plugins.html
Scrolling down to the very bottom of the 'example plugin' code, it appeared to be the Point Labels code that I wanted. Hey! Cool. So, instead of including the external plugin, copy/paste this code into your <script> section.
function ctPointLabels(options) {
return function ctPointLabels(chart) {
var defaultOptions = {
labelClass: 'ct-label',
labelOffset: {
x: 0,
y: -10
},
textAnchor: 'middle'
};
options = Chartist.extend({}, defaultOptions, options);
if (chart instanceof Chartist.Line) {
chart.on('draw', function (data) {
if (data.type === 'point') {
data.group.elem('text', {
x: data.x + options.labelOffset.x,
y: data.y + options.labelOffset.y,
style: 'text-anchor: ' + options.textAnchor
}, options.labelClass).text(data.value.y); // 07.11.17 added ".y"
}
});
}
}
}
Now, in your plugins definitions of the Chartist options, call the local function instead of the external Chartist.plugins.ctPointLabels:
plugins: [
ctPointLabels({
textAnchor: 'middle'
})
]
Run and test. It works on my graph! Let me know if that works for you.
-Dustin
from chartist-plugin-pointlabels.
Solved?
from chartist-plugin-pointlabels.
@dustinnulf Nope, I am still unable to get the point labels working.
from chartist-plugin-pointlabels.
from chartist-plugin-pointlabels.
Related Issues (16)
- ctPointLabels is not defined HOT 10
- webpack compability - Chartist is not defined
- constructor.name problematic use HOT 2
- labelInterpolationFnc 0 gets passed as undefined HOT 7
- chartist-plugin-pointlabels doesnt work on production mode HOT 1
- Wrong label position on Bar Charts HOT 8
- [object Object] instead of data HOT 8
- Limits variable availability on falsey "Y" value HOT 3
- TypeError: Cannot read property 'plugins' of undefined HOT 1
- label position in bar chart HOT 1
- AxisX 0 undefined HOT 5
- Overlapping of point labels in multi line chart HOT 2
- How set the color of each point on one line...
- How get and display sum of total values in Bar chart
- Possible for Bar chart? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chartist-plugin-pointlabels.