Open erichiller opened 1 year ago
Hi I was able to use the HeatSeries
to build this, the PointPadding
property removes the default blank space between each point:
var values = new List<WeightedPoint>();
var r = new Random();
for (var i = 0; i < 50; i++)
{
for (var j = 0; j < 20; j++)
{
if (r.NextDouble() < 0.40) continue; // 40% chance that the value is empty
var w = r.Next(0, 100);
values.Add(new WeightedPoint(i, j, w));
}
}
Series = new ISeries[]
{
new HeatSeries<WeightedPoint>
{
PointPadding = new LiveChartsCore.Drawing.Padding(0),
Values = values,
}
};
the XY coordinates are not within a fixed range
You can also use the VisualElements
property to add custom visuals to the plot, would that be enough?
@beto-rodriguez Thank you for the information on PointPadding
, that might be useful in the future.
For this purpose though, it still wouldn't allow use outside a fixed range. The picture I provided is just using some dummy data, the real values have a much larger range, so prepopulating a Heatmap with a bunch of empty values wouldn't be feasible.
With VisualElements
there wouldn't be any of the series logic grouping the values together and I would then have to go through and re-write the entire heat map logic for coloring anyways. So that doesn't seem to be a viable option.
Thanks for the reply, I am afraid that I do not fully understand your needs, do you have an article about the name of this kind of plots? is it a custom plot for your case?
I'm not sure there's a separate name for it, it's an XY/ Scatter plot that has discrete positions (there is never any smaller difference in values than the data's resolution. eg. If the resolution is 0.25, then positions like 10.00, 10.25, 10.75 would be valid) but there is no min or max range. ( eg. -1,000.25 to +15,000.75), in this respect its a normal XY chart.
The difference is how the points are displayed. The points are always the minimum resolution wide x high.
To continue my above example, X axis unit is date time, and the minimum time resolution is 100ms. So the points should always be represented as being 0.25 high × 100ms wide, no matter the zoom level. If the screen is displaying times from 500ms to 1000ms and X values 40 to 42 and I have a point at 40.50, 700ms then the point should take up ⅕ of the display wide by ⅛ of the display tall. If the screen is displaying times from 0ms to 5000ms and X values 40 to 60 (10x before) and I have a point at 40.50, 700ms then the point should take up 1/50 of the display wide by 1/80 of the display tall.
The second component is gradient coloring use the min and max of the weight (same as Heatmap does).
zoomed out somewhat:
zoomed in:
I would think others would benefit from being able to do this, but if not, I believe it would be worthwhile for users to be able to extend ScatterSeries
or any series for that matter.
I'm working to create a chart that has:
TertiaryValue
(orQuaternaryValue
orQuinaryValue
)GeometrySize
that is fixed to either exactlyUnitWidth
or a fraction thereof (optionally) variable size. Note that this is the same request as HowTo : Scatter - Have GeometrySize related to Y axis #287.ScatterSeries
usesGeometrySize
that is measured in pixels, which when zooming in creates giant gaps.Similar to a
HeatSeries
, but:ScatterSeries
).UnitWidth
), but continuous XY coordinates would most likely be desirable for others.I created a demo, but it requires adding it directly to LiveCharts as many of the necessary items are internal-only (See number 2 below).
Example:
Options:
GeometrySize
to usescale.MeasureInPixels(axis.UnitWidth)
asHeatSeries
does, then width and height could useGeometrySize
as a float and calculate size likeUnitWidth * GeometrySize
.HeatSeries
.ChartPoint.Context.Visual
setter in order to initialize the point's visual.ChartPoint.Context.HoverArea
setterChartPoint.Context.Label
setterChartPointCleanupContext
classBounds
class constructorPointMeasured
event to change all the point / geometry properties after they have been calculated byScatterSeries
. This has the downsides:Tertiary
because thenScatterSeries
will do its own math to change point size.If I am missing a way to achieve this that already exists, please let me know.