Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ToolTips #1305

Open
Bradley-H opened this issue Jan 31, 2022 · 3 comments
Open

ToolTips #1305

Bradley-H opened this issue Jan 31, 2022 · 3 comments

Comments

@Bradley-H
Copy link

From what I can tell in the docs, There is nothing on Tooltips, I'd like a little more information on my charts when I hover over something, especially for my clients.

@pmoayer
Copy link

pmoayer commented Feb 2, 2022

https://gionkunz.github.io/chartist-js/plugins.html#tooltip-plugin

@stklcode
Copy link

There is a hacky workaround for the plugin v0.1.4 to work with Chartist v1 UMD version. The chart classes have to be aliased, because Bar was renamed to BarChart, etc.

<html>
<head>
  <title>Chartist test</title>
  <script src="node_modules/chartist/dist/index.umd.js"></script>
  <script src="node_modules/chartist-plugin-tooltips-updated/dist/chartist-plugin-tooltip.min.js"></script>
  <link rel="stylesheet" href="node_modules/chartist/dist/index.css">
  <link rel="stylesheet" href="node_modules/chartist-plugin-tooltips-updated/dist/chartist-plugin-tooltip.css">
</head>
<body>
<div id="chart" style="height: 50vh"></div>

<script>
  /* Dirty hack to make the tooltip plugin compatible with Chartist v1.
      The chart classes have been renamed, but functionality remains unchanged, so we define aliases. */
  Chartist.Bar = Chartist.BarChart;
  Chartist.Pie = Chartist.PieChart;
  Chartist.Line = Chartist.LineChart;

  new Chartist.LineChart(
    '#chart',
    {
      labels: [1, 2, 3, 4, 5, 6, 7, 8],
      series: [[5, 9, 7, 8, 5, 3, 5, 4]]
    },
    {
      low: 0,
      showArea: true,
      plugins: [ Chartist.plugins.tooltip() ]
    }
  );
</script>
</body>
</html>

I know, that's not perfect, but it does the job for now. However, there is some work in progress updating the plugin
LukBukkit/chartist-plugin-tooltip#20 (minimal changes)
stklcode/chartist-plugin-tooltip@main (major rework of the project)

I'll keep you updated when there is anything to be published.

@V-Py
Copy link

V-Py commented Jun 16, 2023

Hi, is there any updates regarding this feature/plugin ?
If I want to help on this subject what's the place to do it since there is two plugins and the main library ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants