Hi,
When I use one numeric column in a line chart, the chart displays a horizontal line over the chart. When I try to do the same in a stacked line chart, nothing happens.
Apparently when I add another numeric column to the DataSource with the same values as the first numeric column, I get the result I want. But I don't want to do this because of two reasons:It means I should 'hack' my code with a fake column and more importantly, the description on the X-axis does not make sense anymore (a label on each side of the chart instead of one in the center).
In the documentation I found "Note that it is recommended that the data set contains two or more numeric columns so that each line can have two or more points.". So it says recommended, but not mandatory.
Can someone help me to get horizintal lines with one numeric data column in a stacked line chart? Thanks in advance.
I am using version 10.3.20103.1000.
Hello TorX,
I`ll try to explain why it is not possible to have stacked line chart using only one numeric data column. Let`s take a look at the table in our online documentation. Each row in the table (IBM, MSN, MCI ….) represent a line in your chart. Each numeric column (Monday, Tuesday… ) represent point for relevant line. So if we want to draw just one line (for example IBM series) we need one row in the table and two numeric columns (for example Monday and Tuesday – the line will be between these two points).
In our scenario we need to have stacked lines, so we need to add by one row in the table for each line in the chart. If we want to have more complicated lines (with more points), we need to have additional numeric columns (for example Wednesday, Thursday …)
If we are using the property myColumnLayer.SwapRowsAndColumns = true; we only swap the rows with columns. It means that each line will be represent by column and each point for relevant line will be represent by row in the table.
In both scenarios we need to have two or more rows and two or more columns to be able to draw stacked line chart.
Please let me know if you have any questions.
Regards
StockName
Monday
Tuesday
Wednesday
Thursday
Friday
IBM
111
96
85
125
65
MSN
75
23
15
100
MCI
55
63
84
95
80
ATT
12
40
60
50
VER
69
110
98
123
Thanks for the reply, but I don't really see the explanation of why it's not possible. I already understand how the stacked line chart works, and how I should feed the data. For example, I have this in my datasource:
When I feed this to a normal line chart, I get 4 horizontal lines. But when I feed this to a stacked line chart, nothing happens. I would expect to get 4 horizontal lines with a y-value of: 5, 15, 30 and 50 (the cumulative scores).
Maybe if you can explain why I do get horizintal lines in a normal linechart, and not in a stacked line chart, I might understand.
On a sidenote, my employer later told me he wanted the stacked lines filled with a color underneath, so I went on to use a stacked area chart instead. However, the same problem occurs there too.
Error? I said no error is generated. The sample project is a good idea. I attached a project with two charts, both using the same datasource. When there is just 1 column, the line chart shows the lines horizontally, but the stacked line chart does not. When you press the button below, a column is added and both charts show horizontal lines (as they should).
In my opinion, both charts should act the same when there is only one column.
Hello Boris,
Have you been able to investigate my example?
I have contacted our engineering staff about your enquiry and will provide you an answer soon.
Thank you for using our controls and components.
Could you please try to set: Data.SwapRowsAndColumns = true; and see if it helps.
Please do not hesitate to contact us if you need any additional assistance.
Hi Boris,
No that doesn't work. When I set Data.SwapRowsAndColumns = true on chart 2, I get a chart with 1 (filled) line at an angle. When I also transpose the DataSource, the original problem occurs again (no lines visible). When I add a row (to the transposed DataSource) with the same values as the first row, the correct chart appears. However, that is the same workaround as adding another column when Data.SwapRowsAndColumns = false, as seen in my sample project.
It's not a question of "how can I get horizontal lines on a stacked line chart with one column", because I already use the workaround suggested by Georgi. It's "why does the line chart behave differently from the stacked line chart with the same datasource"? They really should behave the same.
Thanks again for your time.
I created the following case for you: 'CAS-88750-XGQYJX' and I will update you on that matter through it.