Strange Chart Bar width

Hello,

i have a multiseries bar Chart.
Everything works ok.
But as i start to add more series(dynamically via API) to Chart, the chart seems to look strange.

Here is the picture: http://imgur.com/YJVrYn0
For example in the first chart i added 4 series and it looks OK.
But then when i contunued to add series (13 in chart 2) the bars are really small
in width. I tried to change their widht with “barWidth: 40” but this does not seem to work.

Regards

Hello,

Can you provide a snippet of the issue? Bar width should decrease if there’s no enough space for all bars, as shown in our example

First of all, your series are defined in a wrong way. As a matter of fact, you have eight series instead of two:

http://webix.com/snippet/2af52b40

In this case, bar width is calculated considering the rest seven (empty) values.

On the other hand, if you’re not going to unify bars related to different customers, there is another solution.

http://webix.com/snippet/3e06099f

You can create a chart without series and filter it by customer name. Here’s a sample.

Hi,

here is the snippet. As you can see the bars in your example are much nicer (have a decent width) not like in my snippet.

As far as i can see the only difference is that in my example i work with multiple series.

http://webix.com/snippet/395f453d

Also i would ask what is the difference between chart.add() and chart.addSeries()

i was inder impression that i should alwasy work with “series” if i want an interactive chart (adding/removing bars based on user input).

Hi,

first of all thank you for all of the examples. It really helps me to understand the charts a little bit more.

As of my snippet example, it was a little misledaing. In reality i truly want eight series. Each serie its own bar. I did this so i can add/remove the bars dynamically by adding/removing series.

Bellow is the improved example. As you can see the bars are really thin.
Visually it looks like the bar widths are calculated based on “series” counts and not on “bar” counts.

http://webix.com/snippet/2e8da88b

Hi,

the bar widths are calculated based on “series” counts and not on “bar” counts

Yes, you are correct. Series are used to show multiple values per one x-axis unit. In case of bars, each series takes its space.

If you are going to show only one value per unit, you should not use multiple series.

Legend is not the only way to hide bars. You can use filtering:

http://docs.webix.com/samples/08_chart/08_dynamic/04_filtering.html

and additional widget to change filtering state (Form, List, Datatble,…):

http://webix.com/snippet/c05a00de