Coder Social home page Coder Social logo

Chart is invisble about amcharts5 HOT 11 CLOSED

nseb avatar nseb commented on August 22, 2024
Chart is invisble

from amcharts5.

Comments (11)

nseb avatar nseb commented on August 22, 2024 1

@martynasma , I found the problem for the graph invisible in case CategoryAxis , we need add : xAxis.data.setAll(data);
for the probleme scrollbarX , you are right, I am making the modification

from amcharts5.

martynasma avatar martynasma commented on August 22, 2024

The code looks good at first glance. Can you also post your data?

from amcharts5.

nseb avatar nseb commented on August 22, 2024

@martynasma , simpe data:
series.data.setAll([
{label : "t1" , value : 10 },
{label : "t2" , value : 11 }
]);
image

I try with beta 7 , same issue

from amcharts5.

nseb avatar nseb commented on August 22, 2024

Replace:
valueXField: 'label' by valueXField: 'date', try datas retrieve for your doc site :
series.data.pushAll([{
date: new Date(2021, 0, 1).getTime(),
value: 1000
}, {
date: new Date(2021, 0, 2).getTime(),
value: 800
}, {
date: new Date(2021, 0, 4).getTime(),
value: 800
}, {
date: new Date(2021, 0, 5).getTime(),
value: 800
}]);

It's works  , but poor quality and no preview in zoom bar

image

from amcharts5.

martynasma avatar martynasma commented on August 22, 2024

You have two ValueAxis and data that is supplying strings. You should probably use CategoryAxis.

For how to configure XYChartScrollbar refer to this doc:
https://www.amcharts.com/docs/v5/charts/xy-chart/scrollbars/#Scrollbar_with_chart_preview

from amcharts5.

nseb avatar nseb commented on August 22, 2024

@martynasma see the first code, I had configured scrollbar with preview.
New code , same issue:

let root = am5.Root.new('linechartdiv');

root.setThemes([
  am5themes_Animated.new(root)
]);

let chart = root.container.children.push(
  am5xy.XYChart.new(root, {
    panX: true,
    wheelable : false,
    wheelX : 'none',
    wheelY : 'none'
  })
)
// Add data
const data = this.resultData.results
  ? this.resultData.results.map(item => ({label: ` (${item.identifier})`, value: item.value})) : []


// Create axes
let xAxis = chart.xAxes.push(
  am5xy.CategoryAxis.new(root, {
    categoryField: "label",
    renderer: am5xy.AxisRendererX.new(root, {})
  })
);

let valueAxis = chart.yAxes.push(
  am5xy.ValueAxis.new(root, {
    renderer: am5xy.AxisRendererY.new(root, {})
  })
);

// Create series
let series = chart.series.push(
  am5xy.SmoothedXLineSeries.new(root, {
    name : 'Results',
    valueYField: 'value',
    categoryXField : 'label',
    xAxis : xAxis,
    yAxis : valueAxis
  }));
series.strokes.template.setAll({
  strokeWidth: 2
});

console.table(data);


const cursor = chart.set("cursor", am5xy.XYCursor.new(root, { behavior: "zoomX" }));
cursor.lineY.set("visible", false);


let scrollbarX = am5xy.XYChartScrollbar.new(root, {
  orientation: "horizontal",
  height: 50,
});
chart.set("scrollbarX", scrollbarX)

series.data.setAll(data);

series.appear();
chart.appear();

from amcharts5.

martynasma avatar martynasma commented on August 22, 2024

I don't see any series being added to the scrollbarX. You might've missed that part in docs:

https://www.amcharts.com/docs/v5/charts/xy-chart/scrollbars/#Scrollbar_with_chart_preview

from amcharts5.

nseb avatar nseb commented on August 22, 2024

I have a test working ;-)
image

We have small issues with horizontal preview, when I drag the button ,pointer mouse is staggered.
It's possible to set font-family in chart to to have a smoother rendering

from amcharts5.

martynasma avatar martynasma commented on August 22, 2024

Let's keep this place clutter-free, both for our own sake and the other's. If you have other questions, not directly related to original topic, please post a separate issue.

from amcharts5.

github-actions avatar github-actions commented on August 22, 2024

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

from amcharts5.

sassomedia avatar sassomedia commented on August 22, 2024

@martynasma Looks like the bot has some issues, there's a bunch of stale posts that it didn't close.

from amcharts5.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.