RicardoP
Posts: 5
Joined: Tue Sep 20, 2022 7:07 am

How to show only the points with line Series

Hello I would like to know how to hide the line that is connecting the dots. I am using LineSeries with Markes where only specific points have a marker.

I am attaching a preview of the picture.

I am using HigchartsStocks for .NET

here is the snippet:

Code: Select all


 public Series GetShape(IShape shape)
        {
            var serie = new LineSeries();
            var data = new List<LineSeriesData>();
            for (int i = 0; i <= shape.Points.Count() - 1; i++)
            {
                var lineData = new LineSeriesData()
                {
                    Drilldown = shape.Points.ElementAt(i).DateTime.ToString(),
                    Y = Convert.ToDouble(shape.Points.ElementAt(i).Value),
                    Name = shape.Title,
                    Marker = new LineSeriesDataMarker()
                    {
                        Enabled = shape.Points.ElementAt(i).IsEnabled,
                        FillColor = shape.Points.ElementAt(i).IsEnabled? shape.Points.ElementAt(i).Color: "#00FFFFFF",
                        LineWidth = shape.LineWidth,
                    }
                };
                data.Add(lineData);
            }
            serie.Data = data;
            serie.Name = shape.Title;
            return serie;
        }
Thank you.
Attachments
chartdots.png
chartdots.png (55.99 KiB) Viewed 1014 times
kamil.m
Posts: 892
Joined: Thu May 19, 2022 1:33 pm

Re: How to show only the points with line Series

Hello there!

Thank you for reaching out to us.

I would suggest two solutions. One would be to change the lineWidth to 0, the second one is to change the series type to 'scatter'.

Take a look at both implementations here: https://jsfiddle.net/BlackLabel/orn82da7/

Do not hesitate to contact us anytime,
Best regards!
Kamil Musiałowski
Highcharts Developer
RicardoP
Posts: 5
Joined: Tue Sep 20, 2022 7:07 am

Re: How to show only the points with line Series

Thank you! Fixed!
kamil.m
Posts: 892
Joined: Thu May 19, 2022 1:33 pm

Re: How to show only the points with line Series

You're welcome!

Do not hesitate to contact us again!
Kamil Musiałowski
Highcharts Developer

Return to “Highcharts Stock”