Sample line in legend too long
d-Rickyy-b opened this issue · 5 comments
Hi there and thank you so much for this great project!
I just created my first chart and was wondering if there's the ability to change the length of the "sample" line shown in the legend. It's ridiculously long in the following example:
I'll attach a minimal configuration (without actual values) for the above chart:
mainSeries := chart.TimeSeries{
Name: "Intel Core i5-12600K, 6C+4c/16T, 3.70-4.90GHz, boxed ohne Kühler (BX8071512600K)",
Style: chart.Style{
StrokeColor: <...>,
StrokeWidth: 2,
},
}
linRegSeries := &chart.LinearRegressionSeries{
Name: "Trend",
InnerSeries: mainSeries,
Style: chart.Style{
StrokeColor: <...>,
StrokeWidth: 2,
StrokeDashArray: []float64{5.0, 5.0},
},
}
graph := chart.Chart{
Width: 1280,
Height: 720,
YAxis: chart.YAxis{
Name: "Preis",
Range: &chart.ContinuousRange{
Min: minPrice - (maxPrice)*0.1,
Max: maxPrice + (maxPrice)*0.1,
},
},
XAxis: chart.XAxis{
Name: "Datum",
},
Series: []chart.Series{
mainSeries,
linRegSeries,
},
}
graph.Elements = []chart.Renderable{chart.Legend(&graph, chart.Style{
FillColor: <...>,
FontColor: <...>,
})}
Even in other cases it just looks a bit weird:
Thank you in advance!
Cheers,
Rico
hey!
Sorry I'm just seeing this, that's a great suggestion, lemme take a crack at creating an option for it.
Hi @wcharczuk - I implemented a fix for this in #189. I added it as a new legend type (new func) instead of modifying your Legend func. Please let me know what you think about it. Would be great if you could merge my changes.
Also I added #190 which implements several style improvements.
PS: I saw that there are a lot of open issues and several PRs - if you need help maintaining this repo, let me know. I'd be happy to help. But I can also understand if you don't want to.
Hey @wcharczuk - mind checking the PR?
Hi @wcharczuk, could you please check the PR?