Posted 17 July 2019, 4:49 am EST
Hi,
I’m using wijmo react and trying to create function series based on calculated trend line equation.
I’ve used Polynomial fit type and my equation looks like this: y = -3e - 35x3 + 8e - 23x2 - 6e - 11x + 131.15.
First of all, can I format this equation in another form? How can I use fmt property of getEquation() function to get for example scientific format?
Now I’m trying to crate series on my other chart using this equation. I’ve created function series like this:
<FlexChart
initialized={props.initChart}
itemsSource={props.historyFluid}
bindingX="Date"
chartType="Scatter"
header={translate('LABEL_STATICPRESSUREHISTORY')}
legendToggle={true}
style={{ height: 700 }}
symbolSize={5}
tooltip={{content: "<b>" + translate("WellName") +": {WellName}</b> <br/>{x} {y}"}} >
<FlexChartLegend position="Top" />
<FlexChartAxis wjProperty="axisX" format="MM-yyyy" labelAngle={45} majorUnit={30} />
<FlexChartAxis wjProperty="axisY" min={0} majorGrid={true} title={unitCaptionPressureH('SPPress')} />
<FlexChartSeries
itemsSource={props.includedStaticPressures}
name={translate('SPPress')}
binding="SPPress"
style={{ fill: 'SteelBlue', stroke: 'SteelBlue'}} >
</FlexChartSeries>
<FlexChartSeries
itemsSource={props.excludedStaticPressures}
name={translate('LABEL_PRESSUREHISTORY_EXCLUDEDPRESSURES')}
binding="SPPress"
style={{fill: 'DarkGrey', stroke: 'DarkGrey'}} >
</FlexChartSeries>
<FlexChartSeries
itemsSource={props.historyFluid}
name={translate('MPF')}
binding="MPF"
chartType="Line"
style={{ strokeWidth: 1, fill: 'black', stroke: 'black'}} >
<FlexChartAxis wjProperty="axisY" max={props.maxAxisY} position="Right" majorGrid={false} title={unitCaptionPressureH('MPF')} />
</FlexChartSeries>
<FlexChartYFunctionSeries
name="y = f(x)"
itemsSource={props.historyFluid}
binding="MPF"
bindingX="Date"
sampleCount={3000}
func={props.yFunc}
>
</FlexChartYFunctionSeries>
</FlexChart>
yFunc = (x) => {
return -3 * Math.E - 35 * Math.pow(x, 3) + 8 * Math.E - 23 * Math.pow(x, 2) - 6 * Math.E - 11 * x + 131.35;
};
And it doesn’t work right… When I log x values, it always gives me the same date (1970).
Is there a problem with dates or I’m doing something wrong?